红联Linux门户
Linux帮助

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

发布时间:2017-05-21 10:04:48来源:blog.csdn.net/webdev_l作者:webdev_l
新建一用户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/advantage
Welcome to Alibaba Cloud Elastic Compute Service !
$ ls
$ ls
$ ls
$ cd 
$ cd /
$ sudo ls
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.
$ 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/passwd
test: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
 
本文永久更新地址:http://www.linuxdiyf.com/linux/30952.html