改变家目录

 

-bash-4.1# grep ^root /etc/passwd
root:x:0:0:root:/data1/apps:/bin/bash
#注意家目录改变前一定要把密钥也同时移到新的家目录里
-bash-4.1# cd ~
-bash-4.1# pwd
/data1/apps
-bash-4.1# ls -all
total 20
drwxr-xr-x 3 root root 4096 Feb 20 09:24 .
drwxr-xr-x 3 root root 4096 Feb 19 23:59 ..
-rw------- 1 root root  193 Feb 20 09:23 .bash_history
drwxr-xr-x 2 root root 4096 Feb 20 09:23 .ssh
-rw------- 1 root root 1900 Feb 20 09:24 .viminfo

 新建用户test

[root@86 ~]# useradd test
[root@86 ~]# passwd test
Changing password for user test.
New password: 
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@86 ~]# id test
uid=505(test) gid=505(test) groups=505(test)
[root@86 ~]# usermod -d /tmp/ test
[root@86 ~]# su - test
-bash-4.1$ pwd
/tmp/

但usermod命令对root没有用,只能对普通用户。对root来说应该只有一种方法,就是直接修改/etc/passwd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值