I need to run the following command (with real parameters) after login:
ssh -f user@example.com -L 54321:example.com:54321 -N
I need it only for my user, not all users on the machine. Also, I need it to run whether I login via the GUI or via SSH to a plain shell terminal. I would even like to know how to do this on machines without a GUI installed.
Where would I put the above line to be run as explained?
Adding the command to the end of ~/.profile
should do the trick (where ~
represents your home directory).
Not ~/.bashrc
, which would make it run again every time a bash
shell is started. In contrast, .profile
is only run by interactive login shells. See man bash
and man sh
for more information.
Please note that this will run not just for GUI and SSH logins, but for all logins (or at least all interactive logins), including when you log on in a virtual console.
No comments:
Post a Comment