- generate key
- ssh-keygen -t dsa
- copy key to another server
- ssh-copy-id server2
- ssh without typing the key passphrase
- ssh-agent /bin/bash
- ssh-add
[root@server6 ~]# ssh-agent /bin/bash
[root@server6 ~]# ssh-add
Enter passphrase for /root/.ssh/id_dsa:
Identity added: /root/.ssh/id_dsa (/root/.ssh/id_dsa)
[root@server6 ~]# ssh server7
Last login: Wed Apr 27 17:20:44 2016 from 192.168.23.148
Changing ssh port
- vim /etc/ssh/sshd_config
- Port 2022
- semanage port -a -t ssh_port_t -p tcp 2022
- semanage port -l|grep ssh
- ssh_port_t tcp 2022, 22
- firewall-cmd --permanent --add-port=2022/tcp
- firewall-cmd --reload
Creating SSH Tunnels
- on server1
- ssh -fNL 4444:server8.example.com:80 root@server7.example.com -p 2022
- elinks http://localhost:4444
[root@server6 ~]# netstat -tulpen|grep -i ssh
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 22725 1694/sshd
tcp 0 0 127.0.0.1:4444 0.0.0.0:* LISTEN 0 174870 15288/ssh
tcp6 0 0 :::22 :::* LISTEN 0 22734 1694/sshd
tcp6 0 0 ::1:4444 :::* LISTEN 0 174869 15288/ssh
- ssh -fNL 2020:www.sandervanvugt.nl:80 root@server8.example.com
- elinks http://www.sandervanvugt.nl:2020
No comments:
Post a Comment