Ubuntu新增用户登录之后不能执行命令

来源:互联网 发布:深圳赛维网络招聘 编辑:程序博客网 时间:2024/05/16 00:46

新建一用户test,用该用户登录

Connecting to 129.133.26.18:22...Connection established.To escape to local shell, press 'Ctrl+Alt+]'.Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-63-generic x86_64) * Documentation:  https://help.ubuntu.com * Management:     https://landscape.canonical.com * Support:        https://ubuntu.com/advantageWelcome to Alibaba Cloud Elastic Compute Service !$ ls$ ls$ ls$ cd $ cd /$ sudo lssudo cd /sudo: unable to resolve host iZwz9facu0pduhjuicufmqZ[sudo] password for test: Sorry, try again.[sudo] password for test: test is not in the sudoers file.  This incident will be reported.$ sudo cd /sudo: unable to resolve host iZwz9facu0pduhjuicufmqZ[sudo] password for test: Sorry, try again.[sudo] password for test: test is not in the sudoers file.  This incident will be reported.$ 

只有一个$符号。输入命令,用TAB键也无法补全命令。并且命令不能执行。
使用root用户查看passwd文件

actor@iZwz9facu0pduhjuicufmqZ:/home# grep test /etc/passwdtest:x:1000:1000::/home/test:/bin/sh

原来test用户默认的shell是/bin/sh
将其改为/bin/bash后就可以了。

可以直接 vi /etc/passwd 修改

也可以 :

actor@iZwz9facu0pduhjuicufmqZ:/home# usermod -s /bin/bash -d /home/test test





原创粉丝点击