Unix script on Mac to change Remote settings

Posted on 2011-10-10
Last Modified: 2012-08-14
I need a help assembling a script that activates Remote Login and Remote Management inside the File Sharing in System Preferences (on macs). I have in mind a shell scripts that runs once every day, silently in the background.

The reason for this is that I have two users that know how to change these settings and they are always turning these off which makes these macs miss the routine maintenance and updating procedures. These users claim that when this is on it disturbs their network experience. I think the reason is rather that they think their privacy is endangered or something like that. Anyway, I can't at the moment lock these changes since they have admin rights over their computers.
Question by:Sigurdur Armannsson
    LVL 5

    Expert Comment

    Hi sigurarm,

    If you not yet on Lion, these commands work for certain.  They are being depreciated in favor of the launchctl.

    # Display whether remote login is on or off.
    systemsetup -getremotelogin

    # Set remote login to on
    systemsetup -setremotelogin on

    I will get the Remote Management piece in just a moment...
    LVL 22

    Author Comment

    by:Sigurdur Armannsson
    Thanks so far. I should have mentioned the Os. It's Lion on all the macs, clients and mine too.

    LVL 5

    Accepted Solution

    Hi again...

    # Enable SSH (RemoteLogin)
    /bin/launchctl load -w /System/Library/LaunchDaemons/ssh.plist

    # Enable RemoteManagement
    /System/Library/CoreServices/RemoteManagement/ -activate

    These all should be 10.7 Compliant.

    -Cheers, Peter.
    LVL 22

    Author Comment

    by:Sigurdur Armannsson
    Looks really nice. Thanks a lot!

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    The /etc/authorization file in Mac OS X 10.x can be used to control access to the various panes of the System Preferences amongst other things. It’s used by some of us Mac Sys Admin’s to give Standard Users access to System Prefs panes that only adm…
    As a Mac user and former AppleCare AHA & Senior Advisor, I'm constantly bombarded with questions about Macs and if they need Antivirus. This short article is my response to those questions.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    27 Experts available now in Live!

    Get 1:1 Help Now