su与sudo的区别
su切换用户身份
/etc/profile --->登录级别的所有用户
/etc/profile.d/*.sh
/etc/bashrc
~/.bash_profile
~/.bashrc
登录级别shell /etc/profile->/etc/profile.d/*.sh->~/.bash_profile->~/.bashrc->/etc/bashrc
su - 用户名
非登录级别shell ~/.bashrc->/etc/bashrc->/etc/profile.d/*.sh
su 用户名
sudo提权
visudo -c #检查语法
vim /etc/sudoers
用户 主机IP或主机名(主机别名、组别名、用户别名) = (转成的用户身份) 管理命令
cfy ALL = (ALL) /usr/sbin/ifconfig
cfy ALL = (ALL) NOPASSWD:/usr/sbin/ifconfig
cfy ALL = (ALL) NOPASSWD:别名
/etc/profile --->登录级别的所有用户
/etc/profile.d/*.sh
/etc/bashrc
~/.bash_profile
~/.bashrc
登录级别shell /etc/profile->/etc/profile.d/*.sh->~/.bash_profile->~/.bashrc->/etc/bashrc
su - 用户名
非登录级别shell ~/.bashrc->/etc/bashrc->/etc/profile.d/*.sh
su 用户名
sudo提权
visudo -c #检查语法
vim /etc/sudoers
用户 主机IP或主机名(主机别名、组别名、用户别名) = (转成的用户身份) 管理命令
cfy ALL = (ALL) /usr/sbin/ifconfig
cfy ALL = (ALL) NOPASSWD:/usr/sbin/ifconfig
cfy ALL = (ALL) NOPASSWD:别名
如有问题请联系我 QQ:1021395023

浙公网安备 33010602011771号