Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

Under "System" > "Preferences" > "Network Connections" I can create PPTP VPNs. This works when I am at a GUI, I can click the network connections icon in the top right, and select a VPN from the list and connect to it.

Is it possible to connect to these PPTP sessions via the terminal if I only have SSH access, using these predefined sessions, so I don't have to type all the details in again?

share|improve this question

marked as duplicate by mchid, Eric Carvalho, Ravan, Charles Green, hg8 Dec 1 '15 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

try to configure pppd, this is an example. i believe you understand that your configuration file can differ.

share|improve this answer
up vote 1 down vote accepted

So it turns out this is a duplicate of another question which I couldn't previously find;

Connect/disconnect from VPN from the command line

I would like to add though, to install nmcli on my 10.04 machine I had to;

sudo add-apt-repository ppa:network-manager/trunk  
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install network-manager
share|improve this answer
    
nmcli is now available without a ppa 15.10 – mchid Nov 30 '15 at 9:37

use the 'pppd' to accomplish it:

sudo pppd nodetach defaultroute replacedefaultroute persist password mypassword file myvpn

replace "mypassword" with your pptp account's password. the "myvpn" is a config file, format as:

linkname myvpn 
ipparam myvpn 
pty "pptp server_address --nolaunchpppd " 
name myaccount 
usepeerdns 
require-mppe 
refuse-eap noauth

# adopt defaults from the pptp-linux package 
file /etc/ppp/options.pptp

this config file format is mentioned in here:https://help.ubuntu.com/community/VPNClient

And, "nodetach", or "defaultroute" are options for pppd, been described here:http://manpages.ubuntu.com/manpages/hardy/man8/pppd.8.html

I have use this method in java to setup a pptp client vpn connection, yes, it works.

The pid file, is in /var/run/ppp-xxx.pid, the "xxx" is your linkname that in your config file. You can read the pid of pppd from this pid file send a signal to the pppd, e.g "sudo kill -s SIGTERM pid_of_pppd", to shutdown the pppd.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.