Linux customized configuration tips

项月亮
May 27, 2021
  1. Change promot info(color, path)

Terminal promot info was determined by parameter PS1, check it

echo $PS1

terminal returns info like

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]

\u is current username, \h is the name of host, \w is current path.

change PS1 in ~/.bashrc

# change the info to greeenPS1="\[\e[01;32m\]\u@\h: \W\$\[\e[00m\] "

then activate the PS1 setting permanently.

export PS1source ~/.bashrc

2. Change login promot info

If you want to show message after just input ssh command(before login successfully), modify /etc/issue.net, add the content you like. Do not add message which may leak sensitive info of your server as all anonymous user can see it.

To show message after you login successfully, you should modify file /etc/motd, it’s a safe way for authenticated user.

Then reload the SSH service

service ssh reload

That’s all done.

--

--