【Linux使用及問題解決】用戶登陸時顯示 -bash-4.2$ 問題

集羣的普通用戶在登陸時,會出現 -bash-4.2$ 的狀態html

 

[html]  view plain  copy
 
  1. [root@dl2 home]#su hx  
  2. bash-4.2$  

 

查看 /etc/passwd 文件,顯示用戶 hx 的信息linux

 

[html]  view plain  copy
 
  1. hx:x:1002:1002::/home/hx:/bin/bash  

 

查看 /home目錄下沒有用戶 hx 的目錄bash

 

[html]  view plain  copy
 
  1.   
 
[html]  view plain  copy
 
  1. [root@dl2 home]#ls  

 

 

緣由:在linux下經過useradd方式建立新用戶時,/etc/skel下的配置文件都會複製到/home目錄的新用戶目錄下。spa

 

[html]  view plain  copy
 
  1. [root@dl2 home]$ cd /etc/skel/  
  2. [root@dl2 skel]$ ls -a    
  3. . ..  .bash_logout  .bash_profile .bashrc  .mozilla    



 

解決:首先新建/home/hx目錄.net

 

[html]  view plain  copy
 
  1. [root@dl2 home]#mkdir hx  
  2. [root@dl2 home]#ls  
  3. hx  

 

 

但這個目錄是新建的,缺乏用戶環境配置文件,那麼複製/etc/skel這個目錄的文件到/home/hx中xml

 

[html]  view plain  copy
 
  1. [root@dl2 home]$ cp /etc/skel/.bash_logout  /home/hx/    
  2. [root@dl2 home]$ cp /etc/skel/.bash_profile /home/hx  
  3. [root@dl2 home]$ cp /etc/skel/.bashrc  /home/hx   

 

 

再次登陸htm

 

[html]  view plain  copy
 
  1. [root@dl2 home]#su hx  
  2. [hx@dl2 home]  

 

 

解決blog

相關文章
相關標籤/搜索