在Debian 7中找不到sudo命令

时间:2019-08-20 17:58:31  来源:igfitidea点击:

在重新安装Debian7.0 之后,无法执行sudo:

"sudo: command not found"

应该是sudo没有安装在Debian系统中。

解决方案

切换成超级用户(root)

su -

借助apt-get命令安装sudo

apt-get install sudo

检查sudo 命令

root@debian:~# exit
logout
linux@debian:~$ sudo su -

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for linux: 
linux is not in the sudoers file.  This incident will be reported.
linux@debian:~$

允许某个用户sudo

sudoers文件中没有列出用户名linux,要允许用户linux也可以使用“sudo su-”。
需要编辑sudoers文件。

切换到超级用户root

linux@debian:~$ su -
Password: 
root@debian:~#

编辑/etc/sudoers文件

添加新的1行

vi /etc/sudoers

linux   ALL=(ALL:ALL) ALL

测试

查看linux用户能否sudo

root@debian:~# exit
logout
You have mail in /var/mail/linux

linux@debian:~$ sudo su -
[sudo] password for linux: 
root@debian:~#