You are not logged in.
Hey all
Im working on a setup were i need two ssh commands to be executed at startup. But im not sure if its posible and if so were to put these commands.
The commands looks like this
ssh -vv -N -L 5556:127.0.0.1:5556 root@192.168.1.11
ssh -vv -N -L 5555:127.0.0.1:5555 root@192.168.1.11
After they are run a password needs to be entered. Hopefully it will be posible to put a -force after each command somehow. The -vv might not be needed either.
Any ideas on how to do this ?
Wak
Offline
Look at:
man ssh-keygen
man ssh-copy-id
Offline
My blog: blog.marcdeop.com
Jabber ID: damnshock@jabber.org
Offline
Thx. I know those two. i could run with ssh keys instead of passwords. But the commands still needs to be ran automatically at bootup. Thats the part im not sure about.
Offline
So you problem is not really ssh related, but rather to execute a given script/command at boot time.
Arch Boot Process - rc.local
Offline
Yes and no. The ssh problem remains. How do i run a ssh command like those mentioned above with a password. When i run them in the terminal the password is prompted and i type it in. The rc.local be able to run those commands without me typing in a password, so i think the ssh commands needs to be altered before they are put in any startup script.
Offline
you would've have to run
ssh-keygen -t rsa
as root
then do
ssh-copy-id root@192.168.1.11
and then they shouldnt prompt for passwords.
EDIT:
also why 2 runs against the same host?, wouldn't it be better to just use 1 command?.
example:
ssh -vv -N -L 5556:127.0.0.1:5556 root@192.168.1.11
ssh -vv -N -L 5555:127.0.0.1:5555 root@192.168.1.11
becomes
ssh -vv -N -L 5556:127.0.0.1:5556 -L 5555:127.0.0.1:5555 root@192.168.1.11
?. -L statements does stack if you use em twice , so you can forward more than one port in the same session.
Last edited by revellion (2012-02-12 14:11:45)
Hurricane Electric Certified IPv6 Sage
CPU: Core i7-2600 @ 4.0Ghz | RAM: 16GB (4x4GB) | GFX: AMD Radeon R9 290 4096MB VRAM | HDD: 1x 120GB SATA3 Corsair SSD (~500MB/s RW), 1x SATA2 250GB, 1x SATA2 320GB, 1x 180GB SATA3 Intel SSD
*EDIT* Replaced Nvidia GTX 570 for a AMD Radeon R9 290, and added an extra SSD 180GB
Offline
Thx for your info, i think keys is just the way to go. One statement is better than two, will test it out.
Offline
Thx for your info, i think keys is just the way to go.
That is what Awebb and Damnshock were trying to point out. But it seemed like you understood those concepts.
Offline
If you're using netcfg, one way to make sure your interface is up before the ssh commands run is to create a script like 'ssh-connect.sh' and then put this line at the end of the /etc/network.d/<profile_name> file:
POST_UP="sleep 5; su -c '~/.local/bin/ssh-connect.sh' firecat53"
Scott
edit: oh, and definitely go with ssh-keys/(ssh-agent|keyring)!!
Last edited by firecat53 (2012-02-13 19:42:30)
Offline