ubunt20.04安装完pg切换,环境变量异常

使用网上的方法

dba@mklmi:~$ sudo su - postgres
[sudo] password for dba:
su: warning: cannot change directory to /home/postgres: No such file or directory
$ ls -la
total 40
drwxr-xr-x 4 dba dba 4096 Jul 23 03:10 .
drwxr-xr-x 3 root root 4096 Jul 21 09:49 ..
-rw------- 1 dba dba 385 Jul 23 01:54 .bash_history
-rw-r--r-- 1 dba dba 220 Feb 25 2020 .bash_logout
-rw-r--r-- 1 dba dba 3771 Feb 25 2020 .bashrc
drwx------ 2 dba dba 4096 Jul 21 09:49 .cache
-rw-r--r-- 1 dba dba 807 Feb 25 2020 .profile
drwx------ 2 dba dba 4096 Jul 21 09:49 .ssh
-rw-r--r-- 1 dba dba 0 Jul 21 09:52 .sudo_as_admin_successful
-rw------- 1 dba dba 1064 Jul 21 09:52 .viminfo
-rw------- 1 dba dba 102 Jul 23 03:10 .Xauthority
$ exit
dba@mklmi:~$ cd /home
dba@mklmi:/home$ sudo su - root
root@mklmi:~# cd /home
root@mklmi:/home# ls -la
total 12
drwxr-xr-x 3 root root 4096 Jul 21 09:49 .
drwxr-xr-x 21 root root 4096 Jul 21 10:40 ..
drwxr-xr-x 4 dba dba 4096 Jul 23 03:10 dba
root@mklmi:/home# exit
logout
dba@mklmi:/home$ sudo mkdir /home/postgres
dba@mklmi:/home$ sudo cp -a /etc/skel/. /home/postgres

 

dba@mklmi:/home$ sudo chmod 755 /home/postgres

以上操作还不行

 

发想起默认ubuntu创建的普通帐号,默认shell为/bin/sh,同时也不支持tab等键

用root修改/etc/passwd 调用/bin/sh为/bin/bash

 

 

root@mklmi:/home/postgres# su - postgres
postgres@mklmi:~$

posted @   青空如璃  阅读(132)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
历史上的今天:
2018-07-23 MGR测试及搭建
2018-07-23 碎片计算方法及整理过程
点击右上角即可分享
微信分享提示