2

I am running fish (Friendly Interactive Shell) as my standard terminal in Ubuntu 14.04, rather than bash.

I noticed the following behaviour and don't know, if any of these are the preferred one to gain root access.

I can type the command sudo su or sudo fish and it will both give me super user rights.(The prompt is displayed as root@ubuntu ~#)
Is there any difference in the behaviour of these commands?

The only thing I could understand is, that sudo su uses the fish configuration located in /root/.config/fish/ and sudo fish uses the fish configuration in my home directory /home/uloco/.config/fish.

Is there a possibility to crypt my system by using sudo fish? Will there be any owner changes made to files in my home directory if I use this?

uloco
  • 1,913
  • 3
  • 17
  • 34
  • 1
    also note that sudo has a `-s` option to give you a shell: `sudo -s`. – Joshua Taylor Mar 24 '15 at 13:39
  • Possible duplicate of [What's the difference between \`sudo -i -u user\` and \`sudo su - user\`?](https://stackoverflow.com/q/31696324/608639) – jww Jun 08 '19 at 10:18

1 Answers1

0
  • sudo su executes su as though you were the root user, Which means that the shell that is opened is the shell given in the entry of the user in /etc/passwd in the 6th field. In case of your systems root user it might be /bin/fish. That shell is executed as login shell, so the rc-scripts of the root user are executed.

When you execute sudo fish, then the application fish (the shell) is executable as if you were the root user, but within the environment of the calling user. Thats why fishs rc-scripts are executed.

Which one you should use depends on you:

  • Do you want the environment of root as if you login to the system as root? Then call sudo su.
  • Do you want to preserve your environment, as your aliases and such stuff defined in the shells rc-scritps? Then use sudo fish.

Is there a possibility to crypt my system by using sudo fish?

Its just the environment, you don't crypt anything.

Will there be any owner changes made to files in my home directory if I use this?

Not if you don't change something manually.

Manish Kothari
  • 1,510
  • 1
  • 21
  • 32