Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-26-2013, 03:51 AM
|
#1
|
Member
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349
Rep:
|
Keeping VPN Open Through Terminal
When I SSH into my a remote computer to use a VPN, I use the command line with OpenVPN. The question I have is I cannot use & at the end so it keeps running when I exit SSH, due to needing to enter my usename and password, so how do I keep the network connected and log out of SSH?
Thanks
|
|
|
07-26-2013, 04:18 AM
|
#2
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
One way is to use screen
You can then disconnect ssh but the VPN should still be running
re-attach to screen with screen -x ( if only one session, see its manual for full list of flags )
But
I'm assuming you are logging in via ssh to start the VPN server
The username/password is for what?
is it to get root?
You should probably start OpenVPN as a service
I'd be surprised if OpenVPN didn't have a preconfigured script for this.
so something like
Code:
sudo service OpenVPN start
would do it, ( or sudo /etc/init.d/OpenVPN )
|
|
1 members found this post helpful.
|
07-26-2013, 02:15 PM
|
#3
|
Member
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349
Original Poster
Rep:
|
Thanks for the response. I will look into screen. I am running OpenVPN as a user, it's just after I do the VPN command, it asks me for my VPNs username and password. That is why I can't use & at the end.
|
|
|
07-26-2013, 02:53 PM
|
#4
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
Quote:
Originally Posted by NotAComputerGuy
Thanks for the response. I will look into screen. I am running OpenVPN as a user, it's just after I do the VPN command, it asks me for my VPNs username and password. That is why I can't use & at the end.
|
Ahh, right ok
Well, the 'super fast' tutorial for screen in your use case
- ssh to your box
- screen
Will diplay some help and stuff
- issue your VPN commnads, etc
- Ctrl+a , then Ctrl+d
That detaches the screen, whatever was running is still running
- you are now free to exit ssh
- to reattach your screen session, screen -x
You can have more than one screen session, think of it as multiple windows/tabs.
The really handy thing with screen is the session still runs even if your ssh drops
for instance, ConnectBot on Android and you loose signal.
Last edited by Firerat; 07-26-2013 at 02:54 PM.
Reason: /list
|
|
1 members found this post helpful.
|
07-27-2013, 06:43 AM
|
#5
|
Member
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349
Original Poster
Rep:
|
Perfect!
Thank you very much!
|
|
|
07-30-2013, 04:09 AM
|
#6
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
Just another way. Probably very old school but still very nice.
Start your vpn connection but put a nohup in front of it. This makes the command immune to hangups. So when you log out the process keeps on running. Also put the & at the end to send the process into background. I know you say how do I input my user name and such. When you send the process into background with & the shell gives you a number in square brackets. This is a job number and with fg <job number> you can get the process to be shown in foreground. Now enter your credentials, suspend the job with <CTRL>+Z and have it run in the background with bg <job number>.
If you are not afraid of work check the output of jobs.
|
|
|
All times are GMT -5. The time now is 03:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|