vsftp 를 사용하여 Linux에 FTP서버를 구축한 후 계정별 접속 홈 디렉토리 설정을 하기 위해
별도로 vsftp단에서 해줘야 하는 설정은 없다.
linux 계정 자체의 HOME directory를 원하는 경로로 설정해주면 된다.
웹 호스팅 시 일반적으로 telnet 접속등을 통한 서버 관리는 유저단에서 생각하지 않는 것 같다.
원하는 home 경로는 일반적으로 웹 서버 주소인 /var/www/html 내의 directory를 설정하면 된다.
홈 디렉토리를 변경하는 방법은 2가지 방법이 있다.
1. /etc/passwd 파일을 직접 수정하는 방법
2. usermod 명령어를 사용하는 방법
1. /etc/passwd 파일 수정
hyun:x:501:501::/var/www/html/hyun:/bin/bash
위 계정 설정 값에서 </var/www/html/hyun> 부분은 기존에 /home/hyun이 있던 부분이었다.
해당 위치의 경로를 설정하면 된다.
2. usermod 명령어를 사용하는 방법
usermod -d <변경할 home 경로> <변경할 계정 이름>
ex) usermod -d /var/www/html/hyun hyun
으로 설정하면 된다.
2014년 9월 6일 토요일
2014년 9월 4일 목요일
rhel7 Linux 7 FTP vftpd 설명 및 구현 설정
FTP(File Transfer Protocol)는 가장 오래되면서 가장 공통으로 사용되고 있는 프로토콜이다.
FTP는 외부에서 컴퓨터간 신뢰성 있는 파일전송을 지원한다.
Linux에서 가장 대표적으로 사용되는 FTP는 vsftpd 데몬이다.
rhel 7.0에서도 이전 버전과 마찬가지로 vsftpd를 사용한다.
FTP는 TCP 프로코톨 위에서 동작한다. TCP는 오래된 프로토콜로 암호화되지 않기 때문에 보안성은 취약하다.
FTP는 멀티 네트워크 포트를 사용한다. 이는 초기에 21번 포트를 사용해서 서버를 연다. 일반적으로 알려진 FTP포트가 21번이다.
서버로부터의 데이타는 별도의 data 포트를 통해 클라이언트로 전달된다. 이 포트의 번호는 passive mode, active mode에 따라 달라진다.
Active mode vs Passive mode
Active mode
Active 모드에서 클라이언트는 21번 포트를 사용해 서버와의 연결을 초기화 한 후 클라이언트에서 data용으로 사용할 port를 서버에 전달한다.
이후 서버의 20번 포트는 클라이언트에서 받은 data 포트로 데이터를 전달하고, 전달 완료 후 클라이언트는 ack로 서버의 20번 포트에 응답한다.
클라이언트에서 방화벽 등으로 port가 막혀있을 시 서버에서 클라이언트 port로 파일을 전달하지 못한다.
-> Command 포트는 클라이언트 -> 서버로 접속, Data 포트는 서버 -> 클라이언트로 접속하는 형태
Passive mode
Passive mode는 Active 모드와 같이 초기 21번 포트를 사용하여 클라이언트 -> 서버로 접속한 후 서버에서 data용으로 사용할 포트 번호를 전달 받는다.
클라이언트는 이후 전달 받은 data 포트로 2차 접속을 시도한다.
Passive mode에서는 클라이언트로의 접속 문제를 해결했다. 하지만 서버의 1024~65535 포트를 방화벽에서 다 열어야 하는 문제점이 있었다.( 서버의 data용 port 후보군)
아래는 Redhat 공식 문서의 active vs passive 비교 설명
active mode
Active mode is the original method used by the FTP protocol for transferring data to the client application. When an active-mode data transfer is initiated by the FTP client, the server opens a connection from port 20 on the server to the IP address and a random, unprivileged port (greater than 1024) specified by the client. This arrangement means that the client machine must be allowed to accept connections over any port above 1024. With the growth of insecure networks, such as the Internet, the use of firewalls for protecting client machines is now prevalent. Because these client-side firewalls often deny incoming connections from active-mode FTP servers, passive mode was devised.
passive mode
Passive mode, like active mode, is initiated by the FTP client application. When requesting data from the server, the FTP client indicates it wants to access the data in passive mode and the server provides the IP address and a random, unprivileged port (greater than 1024) on the server. The client then connects to that port on the server to download the requested information.
While passive mode does resolve issues for client-side firewall interference with data connections, it can complicate administration of the server-side firewall. You can reduce the number of open ports on a server by limiting the range of unprivileged ports on the FTP server. This also simplifies the process of configuring firewall rules for the server.
FTP는 외부에서 컴퓨터간 신뢰성 있는 파일전송을 지원한다.
Linux에서 가장 대표적으로 사용되는 FTP는 vsftpd 데몬이다.
rhel 7.0에서도 이전 버전과 마찬가지로 vsftpd를 사용한다.
FTP는 TCP 프로코톨 위에서 동작한다. TCP는 오래된 프로토콜로 암호화되지 않기 때문에 보안성은 취약하다.
FTP는 멀티 네트워크 포트를 사용한다. 이는 초기에 21번 포트를 사용해서 서버를 연다. 일반적으로 알려진 FTP포트가 21번이다.
서버로부터의 데이타는 별도의 data 포트를 통해 클라이언트로 전달된다. 이 포트의 번호는 passive mode, active mode에 따라 달라진다.
Active mode vs Passive mode
Active mode
Active 모드에서 클라이언트는 21번 포트를 사용해 서버와의 연결을 초기화 한 후 클라이언트에서 data용으로 사용할 port를 서버에 전달한다.
이후 서버의 20번 포트는 클라이언트에서 받은 data 포트로 데이터를 전달하고, 전달 완료 후 클라이언트는 ack로 서버의 20번 포트에 응답한다.
클라이언트에서 방화벽 등으로 port가 막혀있을 시 서버에서 클라이언트 port로 파일을 전달하지 못한다.
-> Command 포트는 클라이언트 -> 서버로 접속, Data 포트는 서버 -> 클라이언트로 접속하는 형태
Passive mode
Passive mode는 Active 모드와 같이 초기 21번 포트를 사용하여 클라이언트 -> 서버로 접속한 후 서버에서 data용으로 사용할 포트 번호를 전달 받는다.
클라이언트는 이후 전달 받은 data 포트로 2차 접속을 시도한다.
Passive mode에서는 클라이언트로의 접속 문제를 해결했다. 하지만 서버의 1024~65535 포트를 방화벽에서 다 열어야 하는 문제점이 있었다.( 서버의 data용 port 후보군)
아래는 Redhat 공식 문서의 active vs passive 비교 설명
active mode
Active mode is the original method used by the FTP protocol for transferring data to the client application. When an active-mode data transfer is initiated by the FTP client, the server opens a connection from port 20 on the server to the IP address and a random, unprivileged port (greater than 1024) specified by the client. This arrangement means that the client machine must be allowed to accept connections over any port above 1024. With the growth of insecure networks, such as the Internet, the use of firewalls for protecting client machines is now prevalent. Because these client-side firewalls often deny incoming connections from active-mode FTP servers, passive mode was devised.
passive mode
Passive mode, like active mode, is initiated by the FTP client application. When requesting data from the server, the FTP client indicates it wants to access the data in passive mode and the server provides the IP address and a random, unprivileged port (greater than 1024) on the server. The client then connects to that port on the server to download the requested information.
While passive mode does resolve issues for client-side firewall interference with data connections, it can complicate administration of the server-side firewall. You can reduce the number of open ports on a server by limiting the range of unprivileged ports on the FTP server. This also simplifies the process of configuring firewall rules for the server.
rhel 7 레드햇 리눅스 7.0 NFS 네트워크 파일 시스템
리눅스 7.0 버전 부터는 NFSv4.1이 추가되었다. NFSv4.1에서는 보안강화, 클라이언트 pNFS가 추가 되었다.
NFSv4.1에서는 콜백을 위한 TCP 연결 분할을 필요로 하지 않는다.
Red Hat 리눅스 7.0 버전에서는 default로 NFSv4.0을 지원하며, 마운트가 정상 실행되지 않을 시 NFSv3으로 fall back한다.
모든 버전의 NFS는 TCP 프로토콜을 사용한다. NFSv3의 경우 UDP를 사용하기도 한다.
NFS는 TCP port 2049를 사용한다. NFS의 정상 동작의 위해서 iptables(방화벽) 설정을 미리 해야한다.
NFS는 RPC 통신을 통해 서버와 클라이언트 간 통신을 진행한다. 리눅스 7.0 에서는 rpcbind로 이를 관리한다. 이전 버전에서는 portmap으로 관리함
NFS 마운트는 기존와 같다
mount -t nfs -o [options] host:/remote/export /local/directory
/etc/fstab에는 아래와 같이 등록한다
server:/usr/local/pub /pub nfs defaults 0 0
rhel 7 레드햇 리눅스 7.0 btrfs BTRFS 파일 시스템 생성
BTRFS 는 차세대 리눅스 파일 시스템이다.
관리, 신뢰성, 확장성 측면에서 기존의 파일 시스템보다 개선된 특징을 가진다 .
btrfs 시스템은 mkfs.btrfs 커맨드를 통해 실행한다.
# mkfs.btrfs /dev/device
mkfs 커맨드를 통해 해당 파일 시스템을 생성한 이후에 기존 파일 시스템과 같이 mount 커맨드로 마운트 시킨다.
# mount /dev/device /mount-point
btrfs 파일 시스템 용량 늘리기
# btrfs filesystem resize amount /mount-point
The amount can be a set size, such as "+2g" for an increase in 2 GiB, or it can be "max" to grow the file system to fill the whole block device. ( +2g, +2G 와 같이 대소문자 구별을 하지 않는다. )
btrfs 파일 시스템 용량 줄이기
# btrfs filesystem resize amount /mount-point
Set the amount to the required size to shrink by, such as "-2g" for a decrease of 2 GiB.
btrfs 파일 시스템의 크기를 +, - 뿐만 아니라 특정 크길 지정할 수도 있다.
#btrfs filesystem resize amount /mount-point
Set the amount to the required size of the file system, such as "20g" to make the file system 20 GiB.
amount 값 지정에 따라 확장, 축소, 용량 지정이 설정된다.
rhel 7 레드햇 리눅스 7.0 /proc/ 가상 파일 시스템 공간 /PROC VIRTUAL FILE SYSTEM
대부분의 파일 시스템과는 다르게, /proc 폴더는 텍스트, 바이너리 파일을 저장하지 않는다. 대신에 해당 폴더에는 가상 virtual 파일들을 보관한다. 그래서 /proc 는 일반적으로 가상 파일 시스템으로 언급된다. 이러한 가상 파일들은 매우 큰 데이터라 하더라도 0 bytes의 크기를 가진다.
/proc 디렉토리는 저장용으로 사용되지 않는다. 이 폴더의 주된 목적은 하드웨어, 메모리, 실행중 프로세스 등에 파일 기반 인터페이스를 제공해주기 위함이다. 실시간 정보는 검색된다 많은 시스템들에 의해 검색될 수 있다. 그 중 의 일부는 커널의 실행을 위해서 실행될 수 있다.
/proc 파일들은 시스템 스토리지는 관리하고 모니터링 하는데 사용된다.
/proc/devices
- Displays various character and block devices that are currently configured.
- /proc/filesystems
- Lists all file system types currently supported by the kernel.
- /proc/mdstat
- Contains current information on multiple-disk or RAID configurations on the system, if they exist.
- /proc/mounts
- Lists all mounts currently used by the system.
- /proc/partitions
- Contains partition block allocation information.
For more information about the
/proc file system, refer to the Red Hat Enterprise Linux 7 Deployment Guide. rhel 7 레드햇 리눅스 7.0 Redhat에서만 사용되는 특수 filesystem 경로 location
레드햇에만 특별히 사용되는 경로
- /var/lib/rpm : 대부분의 rpm 파일들이 존재하는 공간
- /var/cache/yum : Package Updater를 위해 사용된다.
- /etc/sysconfig/ : 다양한 시스템 설정값을 저장하는 공간, 부팅 시 해당 폴더 내에 있는 스크립트들이 다수 실행된다.
/etc/sysconfig/ 폴더는 관리 시 매우 중요하다.
rhel 7 레드햇 리눅스 7.0 파일 시스템 관리 File System Structure and Maintenance
df command는 현재 사용중인 파일 시스템의 사용율을 출력한다.
df 커맨드의 default 용량 단위는 block이며, 관리자가 보기 편하게 하기 위해서는 df -h 옵션으로 출력하는 것을 권장한다.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
12G 6.0G 4.6G 57% / /dev/sda1
99M 9.1M 85M 10% /boot
none 316M 0 316M 0% /dev/shm
위의 출력 값에서 /dev/shm 영역은 시스템의 가상 메모리 파일 시스템을 의미한다. (swap 영역인가?)
du 명령어는 현재 sub directory 안 공간 사용량을 출력한다. 위와 마찬가지로 human-readable format으로 변환을 위해 -hs 옵션
du -hs 을 사용한다.
GUI 환경의 경우 gnome-system-monitor의 Filesystem 탭을 참고하면 된다.
Directory 설명
- /boot/ Directory는 부팅에 필요한 정적 파일을 보관한다. 예를 들어 리눅스 커널에 boot 폴더 안에 위치한다. 이 파일들은 부팅 하기 위해 필수이다. 절대로 삭제하거나 수정하면 안 된다.
- /dev/ 디렉토리는 시스템에 연결되 device에 대한 노드를 보관한다. udevd 데몬에 의해 관리된다.
/dev/ 폴더 안 디바에스 네이밍
| File | Description |
|---|---|
| /dev/hda | The master device on the primary IDE channel. |
| /dev/hdb | The slave device on the primary IDE channel. |
| /dev/tty0 | The first virtual console. |
| /dev/tty1 | The second virtual console. |
| /dev/sda | The first device on the primary SCSI or SATA channel. |
| /dev/lp0 | The first parallel port. |
A mapped device
VG 볼륨 그룹 안 논리적 볼륨들은 /dev/mapper/ 폴더 안에 기록된다.
A logical volume in a volume group, for example,
A logical volume in a volume group, for example,
/dev/mapper/VolGroup00-LogVol02.
A traditional storage volume, for example,
/dev/sdbX, where sdb is a storage device name and X is the partition number./dev/sdbX can also be /dev/disk/by-id/WWID, (see Section 26.3.1, “WWID” for more information) or /dev/disk/by-uuid/UUID, (see Section 26.3.2, “UUID and Other Persistent Identifiers” for more information).
- /etc/ 디렉토리에는 시스템 설정 값을 저장한다.
- /media/ 디렉토리는 이동식 저장매체(usb, dvd, cd-rom)에 대한 마운트 포인트로 사용된다.
- /mnt/ 디렉토리는 NFS와 같은 임시 파일 시스템을 위해 사용된다. 이동식 미디어의 마운트는 /media/에 해라. 자동적으로 /media/에 된다.
- /opt/ 디렉토리는 소프트웨어나 add-on 패키지를 위해 사용된다.
- /sys/ 디렉토리는 가상 파일 시스템에 사용됨
- /usr/ 디렉토리는 유저간 공유 가능한 영역 이다.
- /var/ 디렉토리에는 다양한 데이터들이 존재한다. spool directories, logging data, trasient , temp file
system message나 lastlog 는 /var/log파일 안에 있다.
피드 구독하기:
글 (Atom)
