原链接

使用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的工作目录了。

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2021-09-05
  • 2021-06-14
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案