Skip to main content
Question

Change VPN profile username from script

  • Jun 22, 2024 8:11 AM UTC
  • 2 replies
  • 56 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
  • Jun 24, 2024 1:19 PM UTC
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
  • Jun 25, 2024 4:29 AM UTC
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.