Skip to main content
Question

Change VPN profile username from script

  • June 22, 2024
  • 2 replies
  • 21 views

Forum|alt.badge.img+3

Hello everyone,

 

I've been searching high and low for a way to be able to update the username in a VPN profile based on the user who is logged in. We are currently using a configuration profile which works only when only 1 person uses a Macbook but as soon as a 2nd user logs in, the username of the 1st user remains in the VPN settings when the 2nd user tries to connect.

 

Has anyone managed to find a way around this?

2 replies

Forum|alt.badge.img+5
  • New Contributor
  • June 24, 2024
currentUser=$(who | awk '/console/{print $1}')

 

You could try using this command to pull the currently logged in user, then add it to your script, then create a launch daemon/agent to run on login.  


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • June 25, 2024
currentUser=$(who | awk '/console/{print $1}')

 

You could try using this command to pull the currently logged in user, then add it to your script, then create a launch daemon/agent to run on login.  


Thanks. I know how to get the username, it's the actual updating of the VPN profile with that username that's the problem. There seems to be no easy way to do it.