我们经常要使用root的权限,但是有时候我们只想执行一个程序。 那么sudo就很好地代替了su的作用。如果不想每次sudo时都输入密码, 那么就要设置一下/etc/sudoers。如下:
1.为/etc/sudoers文件增加写权限。
chmod +w /etc/sudoers
2.修改文件
chmod +w /etc/sudoers
如何使用sudo?
比如现在想要安装firefox,就执行:
sudo apt-get install firefox
这样就不必转换用户,感觉使用sudo比su更加方便,也更加安全。
1.为/etc/sudoers文件增加写权限。
chmod +w /etc/sudoers
2.修改文件
# /etc/sudoers3.去除写权限,不然运行sudo时会提出出错
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
yao ALL=(ALL)NOPASSWD: ALL
ping ALL=(ALL)NOPASSWD: ALL
root ALL=(ALL) ALL
chmod +w /etc/sudoers
如何使用sudo?
比如现在想要安装firefox,就执行:
sudo apt-get install firefox
这样就不必转换用户,感觉使用sudo比su更加方便,也更加安全。