Showing posts with label SSH. Show all posts
Showing posts with label SSH. Show all posts

Thursday, February 13, 2014

unlock a deny host

1.
$ service denyhosts stop

2.
$ vim /etc/hosts.deny
delete the IP from the file

3.
$ cd /va/lib/denyhosts
$ grep -iRH IP ./*

[root@server denyhosts]# grep -iRH IP ./*
./hosts:IP:0:Sun Feb  9 11:27:57 2014
./hosts-restricted:IP:0:Sun Feb  9 11:27:57 2014
./hosts-root:IP:0:Sun Feb  9 11:27:57 2014
./hosts-valid:IP:11:Sun Feb  9 11:31:57 2014

./users-hosts:username - IP:11:Sun Feb  9 11:31:57 2014

delete the IPs from all of the files. 

4. 
$ service denyhosts start

Tuesday, July 2, 2013

Generate SSH public key authentication

$ ssh-keygen
You can just press enter to create a rsa key pair;
.ssh/id_rsa is your priviate key stays in this machine
.ssh/id_rsa.pub is the public key you need to copy to the remote machine
I would suggest to use a passphrase, which only need to enter once for each OS boot

$ ssh-copy-id username@remote.machine.com
It copies the public key from local machine to a remote machine, and stores it at .ssh/authorized_key file


Wednesday, January 12, 2011

SSH into a computer behind NAT

Go to your router settings page, e.g 192.168.1.1
Go to the port forwarding setting page, configure following settings


External Port
2225
Internal Port
22
Protocol
tcp/udp
To IP Address
192.168.1.102


You may want to set a normal port, because attacked cannot guess that. If you set 22 to 22, you may have may brute force attacks from outside. Set external port as normal port is more secure. 

Then: 
ssh username(AT)corsairxxv(DOT)gotdns(DOT)com -p 2225
or
scp -r -P 2225 username(AT)corsairxxv(DOT)gotdns(DOT)com:~/work/workspace/ChestTest ~/
scp -P 2225 file.zip corsairxxv.gotdns.com:~/