Ubuntu 14.04.3 LTS에서 로그인 메시지를 사용자 정의하는 방법 01:05:33 CDT 2015 System

Ubuntu 14.04.3 LTS에서 로그인 메시지를 사용자 정의하는 방법은 무엇입니까?

아래 로그인 메시지를 사용자 정의하고 싶습니다. 어떤 파일을 편집해야하는지 알려주십시오.

root@10.1.235.227's password:
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Oct 14 01:05:33 CDT 2015

  System load:    0.0             Processes:           117
  Usage of /home: 0.1% of 944MB   Users logged in:     1
  Memory usage:   4%              IP address for eth0: 10.1.235.227
  Swap usage:     0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

0 packages can be updated.
0 updates are security updates.


Last login: Wed Oct 14 01:05:35 2015 from 172.20.20.98



답변

로그인 배너 작성과 같은 사전 로그인 메시지를 사용자 정의하려면 /etc/issue파일 을 편집해야 합니다.

로그인 후 메시지를 사용자 정의하기 위해의 일부 파일을 편집 할 수 있습니다 /etc/update-motd.d. 해당 디렉토리 00-header와 같은 파일은 10-help-text편집하기에 안전합니다.

또 다른 가능성은 .bashrc 파일 끝에 사용자 정의 기능 / 명령을 추가하는 것 입니다.

예를 들어, .mkshrc파일 상단에 다음 함수가 정의되어 있습니다.

 testTTY(){

  isTTY=$(tty | awk '{if ($0~/\/dev\/tty.*/) {print "true"}else{print "false"}}')

  if [ "$isTTY" = "true" ]; then
    printf "You are in virtual console\n"
    printf "current disk usage is"
    df
  fi
}

그리고 마지막에 함수를 호출 .bashrc단지와 testTTY. 코드에서 볼 수 있듯이 함수는 TTY에 로그인했는지 여부를 결정하고 TTY 인 경우 적절한 메시지와 df명령 출력을 표시합니다.


답변

구성 파일은에 /etc/update-motd.d있습니다. 오늘motd메시지를 나타냅니다 .


답변