$3 is empty when run through self service

ctangora
Contributor III

Hello.

We currently do not require login credentials to self service. I believe this is causing the third variable to be empty when scripts are run through self service. Can anyone confirm that (I'm running 8.61). I have a simple script to echo back the $1, $2, $3 and the $3 comes back empty.

The KB article (https://jamfnation.jamfsoftware.com/article.html?id=146) says the the third variable will be filled with the user logged into self service. Does that mean that if you don't require logging in to self service you can't use $3?

Thanks.

Chris

PS -> The point of the original script was to remove the cached MCX files from the computer and local user, via dscl . -mcxdelete /Users/$3.

1 ACCEPTED SOLUTION

Cem
Valued Contributor

that is correct. As you are logging in as anonymous $3 returns empty.

If you would like to capture the logged in user to the computer (who is running the Self Service anonymously from his/her computer account) then use the command below.
user=ls -l /dev/console | cut -d " " -f 4

View solution in original post

4 REPLIES 4

Cem
Valued Contributor

that is correct. As you are logging in as anonymous $3 returns empty.

If you would like to capture the logged in user to the computer (who is running the Self Service anonymously from his/her computer account) then use the command below.
user=ls -l /dev/console | cut -d " " -f 4

ctangora
Contributor III

Gracias Cem!

I just wanted to make sure I was understanding the KB correctly! I am planning on moving it to a weekly/monthly login script anyway, to make sure the user gets the proper settings at least once a week/month.

Cem
Valued Contributor

or you can use MCX

ctangora
Contributor III

Currently we use the MCX, but for some reason there are some machines that won't allow the MCX's to be updated. For example there was a machine that would not look at the proper SUS, delete the MCX, having casper push a new MCX, all of it didn't work. It wasn't until I erased the MCX's via the dscl command and then re-applied with jamf did the MCX's work.