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?

kasperd
  • 1,729
uloco
  • 394

2 Answers2

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.

chaos
  • 27,506
  • 12
  • 74
  • 77
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.

mertyildiran
  • 1,956
  • 2
  • 17
  • 21