3.安全性: 因为需要知道目标用户的密码,su的安全性较低。 4.使用场景: 通常在需要切换到超级用户执行一系列命令时使用,但不推荐直接使用su切换到root用户,而是使用sudo提升权限。 5.使用示例: 5.1)切换到超级用户 su或者su- 5.2)切换到其他用户 su username 5.3)以其他用户身份执行命令 su-c“command” 如果看...
su命令(简称是:substitute或者switch user)用于切换到另一个用户,没有指定用户名,则默认情况下将以root用户登录。 为了向后兼容,su默认不改变当前目录,只设置环境变量HOME和SHELL(如果目标用户不是根用户,则加上USER和LOGNAME)。 常用选项 -c, --command=[command]:指定执行的命令,然后恢复到原来的用户。 -, -l...
因为需要知道目标用户的密码,su的安全性较低。 4. 使用场景: 通常在需要切换到超级用户执行一系列命令时使用,但不推荐直接使用 su切换到 root 用户,而是使用 sudo提升权限。 5. 使用示例: 5.1)切换到超级用户 su或者su - 5.2)切换到其他用户 su username 5.3)以其他用户身份执行命令 su -c “command” 如果...
su命令(简称是:substitute或者switch user)用于切换到另一个用户,没有指定用户名,则默认情况下将以root用户登录。 为了向后兼容,su默认不改变当前目录,只设置环境变量HOME和SHELL(如果目标用户不是根用户,则加上USER和LOGNAME)。 常用选项 -c, --command=[command]:指定执行的命令,然后恢复到原来的用户。 -, -l...
The command adds theNginxsoftware repositories to your system. Conclusion This article explained thesudocommand and how to use it. Refer to the examples to learn how to use the command efficiently. Next, learnthe difference between the sudo and su command....
#sudo [-u username] [command] 指定身份执行命令 #sudo -i 换到root用户,exit登出(当需要处理大量root命令时优先该方法切换) su: Linux解释:运行替换用户和组标志的shell。 切换到其他用户权限。需要root密码。 特点: 需要知道root密码,到root权限后,放飞自我,拥有root的所有权限; ...
su - [user_name] If the command is used without the argument, it switches to the superuser (root) account. How Does the su Command Work? To invoke another user’s shell within the working directory/user environment, use thesucommand (without the hyphen). ...
su 介绍及使用 su命令就是切换用户的工具,比如我们是以普通用户 guest 登录的,但要添加用户,执行 useradd ,guest 用户没有这个权限,只有 root 有权限。 解决办法有两个, 一是退出 guest 用户,重新以 root 用户登录; 二是不退出 guest 用户,使用 su 来切换到 root 下进行添加用户的操作,操作完成后再退出 roo...
sudoers的配置信息存放在ou=suders的子树中,默认OpenLDAP用户并没有指定sudo规则,openldap首先在目录树子树中寻找条目cn=defaults, 如果找到,那么所有的sudoOption属性都会被解析为全局默认值, 这类似于系统sudo(/etc/sudoers)文件中Defaults语句。 当用户到OpenLDAP服务端中查询一个sudo用户权限时一般有两到三次查询。第...
If a normal user needs to perform any system wide changes he needs to use either ‘su‘ or ‘sudo‘ command. Linux: su v/s sudo NOTE– This article is more applicable toUbuntubased distributions, but also applicable to most of the popularLinuxdistributions. ...