简体   繁体   English

sudo su和sudo fish之间的区别

[英]Difference between `sudo su` and `sudo fish`

I am running fish (Friendly Interactive Shell) as my standard terminal in Ubuntu 14.04, rather than bash. 我在Ubuntu 14.04中将fish(Friendly Interactive Shell)作为标准终端运行,而不是bash。

I noticed the following behaviour and don't know, if any of these are the preferred one to gain root access. 我注意到以下行为,并且不知道这些行为是否是获得root访问权限的首选。

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 ~# ) 我可以输入命令sudo susudo fish ,它们都将赋予我超级用​​户权限。(提示符显示为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 . 我唯一能理解的是, sudo su使用位于/root/.config/fish/的fish配置,而sudo fish使用位于我的主目录/home/uloco/.config/fish的fish配置。

Is there a possibility to crypt my system by using sudo fish ? 有可能通过使用sudo fish来加密我的系统吗? Will there be any owner changes made to files in my home directory if I use this? 如果使用此功能,是否会对我的主目录中的文件进行任何所有者更改?

  • 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. sudo su就像您是root用户一样执行su,这意味着打开的shell是在第6字段/ etc / passwd中用户条目中给定的shell。 In case of your systems root user it might be /bin/fish. 对于您的系统root用户,它可能是/ bin / fish。 That shell is executed as login shell, so the rc-scripts of the root user are executed. 该外壳程序将作为登录外壳程序执行,因此将执行root用户的rc脚本。

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. 当执行sudo fish时,应用程序fish(shell)就可以像您是root用户一样执行,但是在调用用户的环境中。 Thats why fishs rc-scripts are executed. 这就是为什么执行鱼rc脚本的原因。

Which one you should use depends on you: 您应该使用哪一个取决于您:

  • Do you want the environment of root as if you login to the system as root? 您是否想要root环境,就像您以root用户身份登录系统一样? Then call sudo su. 然后致电sudo su。
  • Do you want to preserve your environment, as your aliases and such stuff defined in the shells rc-scritps? 您是否要保留环境,作为您的别名以及shell rc-scritps中定义的此类内容? Then use sudo fish. 然后用须藤鱼。

Is there a possibility to crypt my system by using sudo fish? 有可能通过使用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. 如果您不手动更改,则不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM