2013-01-22

SSH linux terminal



$apt-get install openssh-client
$apt-get install openssh-server
 
http://wiki.debian.org/SSH
 

---------------------------------------------------------------------
on client:
$ ssh-keygen -t rsa
$ ls ~/.ssh/
$ cat ~/.ssh/id_rsa.pub
     # copy conten to server "~/.ssh/authorized_keys"
$ ssh-copy-id -i ~/.ssh/id_rsa.pub $remote_user@$remote_host


on server:
$ cat ~/.ssh/authorized_keys

-----------------------------------------------------------------------
create pabulic key on client
 ssh-keygen -t rsa
 copy key from client ~/.id_rsa.pub (line) to server ~/.ssh/authorized_keys (line)
---------------------------------------------------------------------
on client:

    destination (server)         localhost (client)

$ ssh rolas@192.168.1.11 -p 22 -R 22222:192.168.1.15:22


on server:
$ ssh 127.0.0.1 -p 22222
---------------------------------------------------------------------

scp $source_file $remote_user@$remote_host:$destination_file
 
scp $remote_user@$remote_host:$source_file $destination_file 

ssh $remote_user@$remote_host 'ls *.txt'
 



http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html

-------------------------------------------------------------------


GET ETH ACTIVE
$ /sbin/route -n | grep "0.0.0.0" | grep "UG"
0.0.0.0         192.168.1.15     0.0.0.0         UG    0      0        0 eth0

GET IP
$ /sbin/ifconfig eth0 | grep "inet addr:"
    inet addr:192.168.1.15  Bcast:192.168.1.255  Mask:255.255.255.0


No comments:

Post a Comment