Cấu hình Fedora 16 sshd.service - OpenSSH server daemon trên Win 7



I/ Cài đặt SSHD:

SHHD Cho phép mọi người truy cập vào máy chủ từ xa thông qua dịch vụ SSHD. Dịch vụ SSHD là một sự hỗ trợ mới của linux nhằm khắc phục nhược điểm của telnet, giúp mã hóa dữ liệu username, passwork khi đăng nhập. Nó cho phép đăng nhập từ xa vào hệ thống linux và mật khẩu sẽ được mã hóa.
Mặc định khi cài đặt linux thì ssh sẽ được cài đặt.
- Kiểm tra ssh đã được cài đặt hay chưa:
[root@virtualfedora ~]# rpm -qa | grep openssh


openssh-server-5.8p2-16.fc16.1.i686


openssh-clients-5.8p2-16.fc16.1.i686


openssh-5.8p2-16.fc16.1.i686


II/ Cấu hình SSH Server:


File dùng để cấu hình ssh server là /etc/ssh/sshd_config


- Xem file cấu hình sshd_config với các option mặc định:


[root@localhost /]# vi /etc/ssh/sshd_config


- Xóa bỏ dòng #Port 22 thành:


Port 22


- SSHD server khi chạy cần mở port (22) nên ta phải mở port này trên firewall hay tắt firewall.


[root@virtualfedora ~]# service iptables stop


Redirecting to /bin/systemctl  stop iptables.service


[root@virtualfedora ~]# /bin/systemctl stop iptables.service


- Start sshd daemon:


[root@virtualfedora ~]# service sshd start


Redirecting to /bin/systemctl  start sshd.service


[root@virtualfedora ~]# /bin/systemctl start sshd.service


- Kiểm tra dịch vụ sshd daemon:




[root@virtualfedora ~]# service sshd status


Redirecting to /bin/systemctl  status sshd.service


sshd.service - OpenSSH server daemon.


Loaded: loaded (/lib/systemd/system/sshd.service; disabled)


Active: active (running) since Sat, 10 Mar 2012 14:57:38 +0700; 33min ago


Main PID: 2135 (sshd)


CGroup: name=systemd:/system/sshd.service


â 2135 /usr/sbin/sshd -D



III/ SSH Client:


- Truy cập ssh server từ linux:


[root@localhost /]# ssh 192.168.1.1


The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.


RSA key fingerprint is 71:07:14:a9:8a:6f:73:74:f4:d9:1a:99:1b:b2:03:24.


Are you sure you want to continue connecting (yes/no)? yes


Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.root@192.168.1.1's password:


Nhập vào pasword của root


Last login: Wed Apr 21 09:16:55 2010 from 192.168.1.2


Để thoát khỏi ssh server gõ "exit"


Nếu muốn ssh với account khác root thì thêm vào option –l như sau:


[root@localhost /]# ssh -l minhtam 192.168.1.1


minhtam@192.168.1.1's password:


Last login: Thu Mar 25 17:35:09 2010


[minhtam@localhost ~]$


- Sử dụng lệnh scp để thực hiện sao chép qua ssh:


[root@localhost /]# scp /vidu/test.txt 192.168.1.2:/tam


root@192.168.1.2's password:


test.txt 100% 64 0.1KB/s 00:00


Sao chép file test.txt từ server sang thư mục /tam của client 192.168.1.2


Nếu muốn copy cả thư mục thì thêm vào option –r như sau:


[root@localhost /]# scp -r /vidu 192.168.1.2:/tam


root@192.168.1.2's password:


test1.doc 100% 85 0.1KB/s 00:00


kiemtra.txt 100% 11 0.0KB/s 00:00


test.txt 100% 64 0.1KB/s 00:00


Sao chép thư mục vidu sang thu mục /tam của client 192.168.1.2


- Truy cập ssh server từ Windows:


Trên windows cài chương trình PuTTYPortable_0.61_English. Download


Sau khi khi khởi động nhập vào địa chỉ ip và port 22.






Post a Comment

Previous Post Next Post