linux change directory - 修改登入目录

linux下修改用户登入目录

1. 修改/etc/passwd
admin:x:500:500:panda:/home/admin/:/bin/bash
直接修改第6列

2.命令行usermod
usermod -d /newpath user

【家目录】
如果要迁移家目录
usermod -d /newpath -m user
但是newpath不许不存在,不然只是修改了登入目录。家目录下面的文件不会迁移
----
-d, --home HOME_DIR
          The user's new login directory. If the -m option is given the contents
          of the current home directory will be moved to the new home directory,
          which is created if it does not already exist.


3.修改.bashrc
添加cd /newpath

猜你喜欢

转载自runpanda.iteye.com/blog/2072848