2

I am running fish (Friendly Interactive Shell) as my standard shell 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?

1
  • always remember the old commandment: thou shalt not claim root's name in vain! Jan 30, 2015 at 15:15

2 Answers 2

3

sudo su executes su as if you were the root user. That means, 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.

See a full explanation in this answer: 'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

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 something.

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.

1
sudo su

su - change user ID or become superuser

sudo bash

bash - GNU Bourne-Again SHell

sudo fish

fish - is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family.

enter image description here

http://en.wikipedia.org/wiki/Unix_shell#Shell_categories

Bourne-Again shell (bash) and Friendly interactive shell (fish) both are shell types.

4
  • use su - or sudo su - to go directly to the $HOME directory of the user. Jan 30, 2015 at 10:53
  • I'm trying to embed a image but I can't edit: Finally :) Jan 30, 2015 at 10:55
  • just insert the code :) AUs formatting is not really easy Jan 30, 2015 at 10:56
  • @LittleByBlue there was a issue about Imgur or my internet connection :) Jan 30, 2015 at 11:02

Not the answer you're looking for? Browse other questions tagged .