FTP Server 설정
1. vsftpd 설치
sudo apt-get install vsftpd
2. vsftpd 환경 설정
$ sudo vi /etc/vsftpd.conf
...
# Allow anonymous FTP? (Disabled by default)
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
...
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
allow_writeable_chroot=YES
3. vsftpd 재실행
$ sudo restart vsftpd
rtorrent 설정
1. rtorrent 설치
sudo apt-get install rtorrent
$ cd ~
$ vi .rtorrent.rc
# This is an example resource file for rTorrent. Copy to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
#max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
#max_peers_seed = 50
# Maximum number of simultanious uploads per torrent.
#max_uploads = 15
# Global upload and download rate in KiB. "0" for unlimited.
#download_rate = 0
upload_rate = 50
# Default directory to save the downloaded torrents.
directory = ./torrent
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = ./.session
# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=./watch/*.torrent
#schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low.
#schedule = low_diskspace,5,60,close_low_diskspace=100M
# The ip address reported to the tracker.
#ip = 127.0.0.1
#ip = rakshasa.no
# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no
# Port range to use for listening.
#port_range = 6890-6999
# Start opening ports at a random position within the port range.
#port_random = no
# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
#check_hash = no
# Set whether the client should try to connect to UDP trackers.
#use_udp_trackers = yes
# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
# encryption = allow_incoming,enable_retry,prefer_plaintext
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
# dht = auto
# UDP port to use for DHT.
#
# dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
# peer_exchange = yes
3. 외장하드 자동 마운트 설정
$ sudo mkdir /media/verbatim
$ sudo blkid
/dev/sda1: UUID="2de63ca9-e8db-4393-a378-266603ba016e" TYPE="ext4"
/dev/sda5: UUID="ed7d07fa-6e5a-4ded-933f-87133ee4de37" TYPE="swap"
/dev/sdb1: LABEL="VERBATIM HD" UUID="4CA2-F71B" TYPE="vfat"
$ cat /etc/passwd
...
khb:x:1000:1000:khb,,,:/home/khb:/bin/bash
$ sudo vi /etc/fstab
...
# mount device with rw access to specific user
UUID=4CA2-F71B /media/verbatim vfat umask=0022,uid=1000,gid=1000 0 0
# allowing ftp access to files outside the home directory chroot
/media/verbatim/torrent /home/khb/torrent none bind
4. 필요한 디렉토리 생성
$ cd ~
$ sudo mkdir ./.session
$ sudo mkdir ./watch
$ sudo mkdir ./torrent
5. 자동 마운트 확인하기 위하여 재부팅
$ sudo reboot
6. rtorrnet 실행
$ rtorrent
*** rTorrent 0.9.2/0.13.2 - ubuntu:866 ***
[View: main]
[Throttle 200/off KB] [Rate 0.0/ 0.0 KB] [Port: 6999] [U 0/50] [D 0/0]
방향키 : 목록에서 토렌트 선택
ctrl+d : 선택된 토렌트 정지 / 정지된 토렌트 삭제
ctrl+s : 정지된 토렌트 시작
7. 이제 watch 디렉토리에 torrent 파일을 업로드하면 자동으로 다운로드를 시작한다.
부팅 시 rtorrent 자동 실행
1. screen 설치
sudo apt-get install screen
2. 데몬 스크립트 작성 (create-simple-daemon)
DAEMON_ARGS의 rtorrent 옵션을 생략하면 watch 디렉토리의 torrent 파일을 감지하지 못하는 증상이 발생해서 rtorrent 옵션을 직접 입력하였다. -n 옵션을 사용하면 .rtorrent.rc 파일은 무시된다.
$ sudo cp /etc/init.d/skeleton /etc/init.d/rtorrentd
$ sudo chmod 775 /etc/init.d/rtorrentd
$ sudo vi /etc/init.d/rtorrentd
...
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="screen with rtorrent"
NAME=screen
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="-dmS rtorrent /usr/bin/rtorrent -n -d /home/khb/torrent -s
/home/khb/.session -o upload_rate=50 -O
schedule=watch_directory,5,5,load_start=/home/khb/watch/*.torrent"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
...
2. 데몬 활성화
$ sudo update-rc.d rtorrentd defaults 97 03
3. 만약 비활성화 하고 싶다면 아래 명령어를 입력
$ sudo update-rc.d -f rtorrentd remove
4. 재부팅 후 screen을 통해 rtorrent가 실행된 것을 확인
$ sudo screen -list
There is a screen on:
862.rtorrent (03/25/2015 12:28:19 AM) (Detached)
1 Socket in /var/run/screen/S-root.
5. detached된 screen으로 접속(attach)
$ sudo screen -r
*** rTorrent 0.9.2/0.13.2 - ubuntu:866 ***
[View: main]
[Throttle 200/off KB] [Rate 0.0/ 0.0 KB] [Port: 6999] [U 0/50] [D 0/0]
ctrl + a d : screen detach
ctrl + a q : screen quit
참고
'Linux' 카테고리의 다른 글
우분투 CPU 클럭 조정기로 전기세 절약하기 (0) | 2015.04.01 |
---|---|
USB로 ubuntu server 설치하면 USB 없이는 부팅이 안되는 문제 (3) | 2015.03.22 |
mount 가능한 파일시스템 확인 (0) | 2015.03.11 |
root가 아닌 유저에 의해 실행된 프로세스가 socket을 열 수 없을 때 (0) | 2015.02.15 |
lighttpd htpasswd 사용하기 (0) | 2015.01.09 |