9

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?

1 Answer 1

14

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" 
5
  • 4
    Note that this will, of course, echo your password as you type it. Commented Mar 6, 2018 at 17:24
  • 3
    It will also store your password in your shell history. Commented Apr 29, 2018 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 ;-) Commented Jun 25, 2021 at 14:35
  • 1
    This answer shows how to prevent echoing/saving the password: askubuntu.com/a/1179680/732215 -- (IFS='' read -s -r -p '802.1X password '; nmcli connection modify id example 802-1x.password "$REPLY") Commented Jul 15, 2021 at 5:37
  • That can still put the password in the process table though very very briefly! Commented Aug 10, 2021 at 0:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.