특정계정만 ssh 접속 불가 sftp 만 접속 가능한 환경 만들기
2019.05.09 19:24
원문 : http://www.ischo.net -- 조인상 // 시스템 엔지니어
Writer : http://www.ischo.net -- ischo // System Engineer in Replubic Of Korea
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
원문 : http://www.ischo.net -- 조인상 //시스템 엔지니어
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
참고 : https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c01516983
목표 : HP-UX 환경에서 sftpuser 계정으로 ssh 접속은 불허용, sftp접속만 가능하도록 구성
1. 디렉토리 생성
# mkdir -m 755 /sftpdir
2. 계정생성
# useradd -d /sftpdir/home/sftpuser -s /bin/sh sftpuser
3. /opt/ssh/utils/ssh_chroot_setup.sh 실행
# /opt/ssh/utils/ssh_chroot_setup.sh
HP SECURE SHELL: CHROOT ENVIRONMENT SETUP - MAIN MENU
-----------------------------------------------------
Select one of the option below
1.Configure a new user
2.Configure an existing user to a chroot-ed user
3.Remove chroot environment from a chroot-ed user
4.Exit
Enter your choice : 2
Chroot setup
---------------
User name (Maximum eight chars) : sftpuser
chroot setup checks for user details ...completed
Enter the new root directory for sftptest with absolute path (or press return for default(/newroot)): /sftpdir
---------------------------------
Select chroot secure shell option
----------------------------------
1 sftp
2 ssh & sftp & scp
press return key to skip this step
Option : 1
chroot setup for sftp operations
IMPORTANT NOTE:
This setup will make sure that sftp works in your chroot environment
It should not be interpreted as a restrictive sftp-only Shell.
This setup simply copies the files required for sftp to the appropriate directories under the newroot.
Now configuring the chroot environment for sftp ...finished
Summary
--------
Chroot-ed user : sftpuser
Chroot-ed user's new root directory : /sftpdir/home/sftpuser
Secure Shell configuration : SFTP
press Return key
HP SECURE SHELL: CHROOT ENVIRONMENT SETUP - MAIN MENU
-----------------------------------------------------
Select one of the option below
1.Configure a new user
2.Configure an existing user to a chroot-ed user
3.Remove chroot environment from a chroot-ed user
4.Exit
Enter your choice : 4
4. chroot 된 디렉토리 환경설정
# chmod 777 /sftpdir/tmp
# chown sftpuser /sftpdir/home/sftpuser
# cp -p /var/adm/wtmp /sftpdir/var/adm
5. chroot된 디렉토리내 sh 삭제
# rm /sftpdir/bin/sh
6. ssh 접속테스트
7. sftp 접속 및 업로드, 파일 삭제 테스트
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
10 | HP-UX 11i v3 - Native Multi-Pathing for Mass Storage | 조인상 | 2011.10.28 | 11096 |
9 | Dynamic Root Disk A.3.9.* Administrator's Guide | 조인상 | 2011.10.28 | 11076 |
8 | HP-UX 11.11 에서 cpu/mem/Kernel info 긁어오는 스크립트 | 조인상 | 2011.06.24 | 10762 |
7 | HP-UX 11i v3 소개 및 release note + Road Map | 조인상 | 2011.10.28 | 10574 |
6 | bdf의 결과를 GB단위로 보여주는 스크립트 [1] | 조인상 | 2015.10.27 | 10057 |
5 | Vmware ESXI 환경에서 HP Smart Array CLI 사용하기 - command 예제 | 조인상 | 2015.07.29 | 9206 |
4 | 파트너 관련 각 시험 코드표 | 조인상 | 2011.06.15 | 8685 |
3 | VG00 의 mirror 상태 점검 스크립트 | 조인상 | 2015.06.12 | 5788 |
2 | HP rx2660서버에서 H/W RAID 구성하기 | ischo | 2019.10.04 | 2355 |
» | 특정계정만 ssh 접속 불가 sftp 만 접속 가능한 환경 만들기 | ischo | 2019.05.09 | 2285 |