I need to set up SSH tunnels from Ubuntu on system start. I have scripts that work well under Debian squeeze. Under Ubuntu though, the su command requires to enter a user password which breaks the startup script.
In detail:
Within the daemon start-script autossh is started with a specific user per tunnel.
These users are created before with
adduser ... --disabled-password
The following line in the startup script:
su -s /bin/sh $USER -c "$AUTOSSH $TUNNEL"
generates a prompt for password (under Ubuntu), even though the tunnel user's PW should be disabled. This stops the script so the service is not started.
I already tried to delete the tunnel user's PW (in case there was some std PW created during creation) but this did not change anything. Web search did not bring a solution. If required I could supply a password as a parameter for the su command, but could not find such an option.
Any ideas how to solve this? Thanks!
# User privilege specification root ALL=(ALL:ALL) ALL me ALL=NOPASSWD: ALL %tunnels ALL=NOPASSWD: ALL root ALL=NOPASSWD: ALLstill, the scriptline below triggers a password prompt:
– sebut Nov 29 '12 at 07:14sudo su -s /bin/sh $USER -c "$AUTOSSH $TUNNEL"sudo -u $USER command arguments– Jeff Ferland Nov 29 '12 at 07:42