Skip to Content
SSH, The Secure Shell: The Definitive Guide, 2nd Edition
book

SSH, The Secure Shell: The Definitive Guide, 2nd Edition

by Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
May 2025
Beginner to intermediate
670 pages
12h 30m
Korean
O'Reilly Media, Inc.
Content preview from SSH, The Secure Shell: The Definitive Guide, 2nd Edition

사용자 로그인 및 계정

로그인이 발생하면 SSH 서버는 특별한 조치를 취할 수 있습니다. 여기에서는 이에 대해 설명합니다:

  • 사용자를 위한 환영 메시지 인쇄

  • 환경 변수 설정

  • 초기화 스크립트로 임의 작업 수행하기

5.6.1 사용자를 위한 환영 메시지

sshd는 인증 전과 후에 사용자에게 사용자 지정 메시지를 표시할 수 있습니다. 인증 전에 SSH 서버는 Banner 키워드(OpenSSH) 또는 BannerMessageFile키워드(Tectia)로 사용자가 선택한 파일의 내용을 선택적으로 표시할 수 있습니다:

    # OpenSSH
    Banner /usr/local/etc/warning.txt

    # Tectia
    BannerMessageFile  /usr/local/etc/warning.txt

기본적으로 OpenSSH는 배너 메시지를 표시하지 않지만, Tectia는 파일이 있는 경우 /etc/ssh2/ssh_banner_message의 내용을 표시합니다.[76] 배너 메시지는 무단 액세스를 금지하는 법적 문구에 자주 사용됩니다. 이 파일은 인증 전에 전송되므로 민감한 정보가 노출되지 않도록 주의하세요.

인증 후 OpenSSH와 Tectia의 sshd는 모두 선택적으로 표준 유닉스 "오늘의 메시지" 파일( /etc/motd )을 출력합니다. 이 출력은 yes (기본값) 또는 no 값과 함께 PrintMotd 키워드로 켜고 끌 수 있습니다:

    PrintMotd no

대부분의 Unix 셸은 로그인 시 /etc/motd를 출력하기 때문에 이 SSH 기능은 중복되어 꺼져 있는 경우가 많습니다.

Tectia의 경우 CheckMail키워드의 값이 yes (기본값)인 경우 로그인 시 이메일에 대한 메시지(예: "메일이 있습니다")가 인쇄되고 no 인 경우 메시지가 건너뛰게 됩니다:

    # Tectia
    CheckMail yes

OpenSSH에서 PrintLastLog 키워드의 값이 yes (기본값)인 경우 마지막 로그인 시간도 인쇄되며, no 인 경우 메시지를 건너뜁니다:

 # OpenSSH
    PrintLastLog yes

Tectia에는 마지막 로그인 시간 인쇄를 제어하는 별도의 키워드가 없으며, 가능한 경우 항상 인쇄됩니다.

SSH 서버는 또한 각 사용자가 이러한 환영 메시지의 인쇄 여부를 제어할 수 있는 유닉스 hushlogin 규칙을 따릅니다. .hushlogin파일이 존재하면 오늘의 메시지, 메일 알림 메시지(Tectia의 경우), 마지막 로그인 시간이 모두 생략됩니다.

5.6.2 환경 변수 설정하기

나중에 살펴보겠지만, SSH 클라이언트는 로그인 셸이 호출되기 전에 서버에서 환경 변수를 설정하는 여러 가지 방법이 있는데,[77] 환경 파일 [7.1.3], SendEnv (OpenSSH) 또는 SetRemoteEnv (Tectia) 구성 키워드 [7.4.4 .3], authorized_keys (OpenSSH) 또는 authorization (Tectia) 파일의 environment 옵션 [8.2.5] 등이 그것입니다. 그러나 이러한 변경은 서버의 허가가 있을 때만 가능하며, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

SSH, The Secure Shell: The Definitive Guide, 2nd Edition

SSH, The Secure Shell: The Definitive Guide, 2nd Edition

Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
Working with SSH

Working with SSH

ACI Learning, Don Pezet

Publisher Resources

ISBN: 9798341656383