could not change directory to "/root" postgresql

原链接

使用root 用户 su postgres切换到postgres用户时 提示

could not change directory to "/root"

使用

su - postgres

su命令和su -命令区别就是:
su只是切换了root身份,但Shell环境仍然是普通用户的Shell;而su -连用户和Shell环境一起切换成root身份了。只有切换了Shell环境才不会出现PATH环境变量错误,报command not found的错误。
su切换成root用户以后,pwd一下,发现工作目录仍然是普通用户的工作目录;而用su -命令切换以后,工作目录变成root的工作目录了。

posted @ 2020-01-08 10:30  BigOrang  阅读(9518)  评论(0编辑  收藏  举报