You are not logged in.
I use ssh as a SOCKS proxy because it provides speed benefits at my university. Is there a way I can start this at boot? Here's the command:
ssh -D 7070 username@hostnameI've tried throwing this in my .xinitrc and backrounding it, along with putting it in my rc.lua (for awesome wm). Neither seem to work, and ssh doesn't show up on a "ps -e" either. What could be the problem?
Offline
Try putting it in a crontab with @reboot.
Offline
Why not write a trivial mysocks.service that simply calls your one-line script?
[Unit]
Description=My script
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/myscript
[Install]
WantedBy=multi-user.targetOffline
never mind... better options given
Last edited by oliver (2013-02-05 00:00:42)
Offline
Why not write a trivial mysocks.service that simply calls your one-line script?
[Unit] Description=My script [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/bin/myscript [Install] WantedBy=multi-user.target
I've tried this solution (mainly because I knew how to do it), and it still is not working. I think part of the problem may be that I use a key generated from ssh-keygen to login without a password. If not run by the correct user, it wouldn't work. Could that be the problem, and how would I resolve it?
EDIT: Didn't look closely at the error message. It says that it failed to start, and upon checking the status, it says
Loaded: error (Reason: No such file or directory)which is strange because everything involved should exist.
Last edited by miscsubbin (2013-02-05 00:22:43)
Offline
I think part of the problem may be that I use a key generated from ssh-keygen to login without a password. If not run by the correct user, it wouldn't work. Could that be the problem, and how would I resolve it?
Then ssh needs to be executed as your username.
Try putting "User=your_user" in the [Service] section.
Offline
miscsubbin wrote:I think part of the problem may be that I use a key generated from ssh-keygen to login without a password. If not run by the correct user, it wouldn't work. Could that be the problem, and how would I resolve it?
Then ssh needs to be executed as your username.
Try putting "User=your_user" in the [Service] section.
Even with this it still gives a "No such file or directory" error when I use
systemctl status ssh-python.serviceI have no idea why. Everything appears to be set up correctly. The script works, and is in the path specified in the .service file. The service is in "$HOME/.config/systemd/user/ssh-socks.service" and the script is in "/usr/local/bin/ssh-socks", and has correct permissions.
Offline
roentgen wrote:miscsubbin wrote:I think part of the problem may be that I use a key generated from ssh-keygen to login without a password. If not run by the correct user, it wouldn't work. Could that be the problem, and how would I resolve it?
Then ssh needs to be executed as your username.
Try putting "User=your_user" in the [Service] section.Even with this it still gives a "No such file or directory" error when I use
systemctl status ssh-python.serviceI have no idea why. Everything appears to be set up correctly. The script works, and is in the path specified in the .service file. The service is in "$HOME/.config/systemd/user/ssh-socks.service" and the script is in "/usr/local/bin/ssh-socks", and has correct permissions.
$HOME/.config/systemd/user/ is for systemd user sessions (which I assume you are not running). You have to put the service file in /etc/systemd/system/.
Offline
OK, now it doesn't throw an error, but I can't seem to access it. And "ps -e" doesn't show an instance of it running.
Offline
OK, now it doesn't throw an error, but I can't seem to access it. And "ps -e" doesn't show an instance of it running.
check the "systemctl status" output. Type=oneshot may be wrong, you may have to use Type=forking or Type=simple, depending on what the process does.
Offline
ssh-python.service - Login to HOSTNAME for use as a SOCKS proxy
Loaded: loaded (/etc/systemd/system/ssh-python.service; enabled)
Active: active (exited) since Tue 2013-02-05 10:10:06 EST; 7h ago
Process: 4432 ExecStart=/usr/local/bin/ssh-python (code=exited, status=0/SUCCESS)Looks like it succeeds then closes. Any way to keep it open?
Offline