8

With nmcli, I can modify VPN data like this:

nmcli con modify myvpn vpn.data 'refuse-pap = yes, user = xxx'

So I'm wondering if I can set password this way as well?

gmarmstrong
  • 1,183
  • 1
  • 15
  • 35
daisy
  • 53,527
  • 78
  • 236
  • 383

1 Answers1

13

Yes, you can modify the value of any property with nmcli. In this case, you would use:

nmcli con modify "myvpn" vpn.secrets "password=myverysecretpassword"
gmarmstrong
  • 1,183
  • 1
  • 15
  • 35
  • 4
    Note that this will, of course, echo your password as you type it. – gmarmstrong Mar 06 '18 at 17:24
  • 3
    It will also store your password in your shell history. – gmarmstrong Apr 29 '18 at 15:05
  • and if you use gpaste and it stores history and you copied your password from something else like lastpass that buffer will have it too ;-) – nhed Jun 25 '21 at 14:35
  • 1
    This answer shows how to prevent echoing/saving the password: https://askubuntu.com/a/1179680/732215 -- (IFS='' read -s -r -p '802.1X password '; nmcli connection modify id example 802-1x.password "$REPLY") – tjb Jul 15 '21 at 05:37
  • That can still put the password in the process table though very very briefly! – anthony Aug 10 '21 at 00:04