FileWave Alliance

The Official Community Forum
  • Page:
  • 1

TOPIC: Enabling Remote Login via Script for admin SSH

Enabling Remote Login via Script for admin SSH 21 Mar 2017 13:45 #2490

  • John Burnett
  • John Burnett's Avatar Topic Author
  • Offline
  • 2nd Level - Yellow Belt
  • 2nd Level - Yellow Belt
  • Posts: 8
  • Thank you received: 0
These commands work locally in terminal, but don't seem to work when pushing to our student machines. Any one that can point me in the right direction would be great. Thanks in advance.

My script in Filewave:

#!/bin/bash
sudo systemsetup -setremotelogin on
sudo dseditgroup -o create -q com.apple.access_ssh
sudo dseditgroup -o edit -a admin -t group com.apple.access_ssh

Enabling Remote Login via Script for admin SSH 21 Mar 2017 21:39 #2491

  • Bao Tran
  • Bao Tran's Avatar
  • Offline
  • FileWave Staff
  • FileWave Staff
  • Posts: 103
  • Karma: 4
  • Thank you received: 13
Your script worked fine for me. Not sure what you did but these are the steps I followed.

1. Add a new empty desktop fileset.
2. Select the fileset in the Filesets section and click the Scripts icon in the menu bar.
3. Highlight Activation Scripts and click the Create button.
4. Paste in your 3 sudo statements.
blah blah blah...
# Add the contents of your script below:

sudo systemsetup -setremotelogin on
sudo dseditgroup -o create -q com.apple.access_ssh
sudo dseditgroup -o edit -a admin -t group com.apple.access_ssh

exit 0

Just remember to adjust the properties for the fileset to restrict it to macOS only.

I tried deploying the fileset both automatically and also via the kiosk. Worked fine both times. Was able to SSH into the client Mac afterwards and Remote Login was enabled whereas it wasn't before.
The following user(s) said Thank You: John Burnett

Enabling Remote Login via Script for admin SSH 12 May 2017 07:17 #2550

  • Tan Ng
  • Tan Ng's Avatar
  • Offline
  • 1st level - White Belt
  • 1st level - White Belt
  • Posts: 3
  • Thank you received: 0
Why do you need to use "sudo"? Per the FileWave Admin manual, the script in Fileset is run as root.

"Scripts in Filesets
Empty Filesets can also be used to deploy scripts. You can create a script, save it as a shell script file, for example <myscript>.sh, and place that into a Fileset. The template for any script is simple:
#!/bin/sh
# Put any script content here exit 0
You can use any of the common shell dialects, such as sh, bash, tsch, or zsh. By default, the script is executed once, by root, when the Fileset is deployed to the Cient. You would set a path for the script to be placed in a location that allows the system to access the appropriate controls, such as in /usr/local/bin/. Once the script file is added to the Fileset, you can set its permissions and other variables using the Contents window, which is accessed by double-clicking the script file inside the Fileset. Note: You do NOT put the “sudo” command into a script that is used in a Fileset; scripts run as root when executed by FileWave."

Enabling Remote Login via Script for admin SSH 12 May 2017 15:51 #2552

  • Bao Tran
  • Bao Tran's Avatar
  • Offline
  • FileWave Staff
  • FileWave Staff
  • Posts: 103
  • Karma: 4
  • Thank you received: 13
You're right that the sudo is completely unnecessary. For the purposes of testing the OP's inquiry it was less work for me to just copy and paste without removing the sudo.
  • Page:
  • 1