Friday, June 12, 2015

Restore Corrupted Bash Shell ( CentOS/RHEL 6.x )

nirav@nirav:~$ ssh root@192.168.0.202
root@192.168.0.202's password:


If you get a prompt like below

-bash-4.1#

Then there are copies of bash environment files in /etc/skel. /etc/skel directory contains files and directories that are added to the user's home directory whenever a new user is created. '.' indicates the files and directories inside are hidden.


So, copy the .bash_logout, .bash_profile, .bashrc files to your home directory.

-bash-4.1# cp /etc/skel/.bash* /root/
 

Press Ctrl+D to logout

-bash-4.1# logout
Connection to 192.168.0.202 closed.
 

nirav@nirav:~$ ssh root@192.168.0.202
root@192.168.0.202's password:


You will again get your bash shell

[root@desktop202 ~]#

No comments:

Post a Comment