windows下Ubuntu使用shmod提示No such file or directory
背景
需要使用ssh连接服务器。
步骤
-
确认是否安装了ssh服务;如图所示,表示我已经安装了ssh;
-
确认ssh是否已经启动了;若无输出则表示尚未启动;
ps -e | grep ssh
-
启动服务;
sudo /etc/init.d/ssh start #server 启动ssh服务 sudo /etc/init.d/ssh stop #server 停止ssh服务 sudo /etc/init.d/ssh restart #server 重启ssh服务
-
启动服务报错,提示 /etc/sudoers is world writable;
-
此为权限问题,使用chmod修改权限但是提示No such file or directory。
pkexec chmod 0440 /etc/sudoers
解决
没有使用root权限进入ubuntu,导致修改不了权限;在cmd模式下设置ubuntu默认用户为root,然后再次进入ubuntu后即可成功运行 chmod命令。
ubuntu config --default-user root