Cannot edit server.cfg

Forum / NoMachine for Mac / Cannot edit server.cfg

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #47124
    horseman67
    Participant

    Hi,

    So I’m following the instructions here: https://kb.nomachine.com/AR02L00785 on how to allow only public key auth with NoMachine.

    However, when i try to edit /Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg

    and update it with the line: AcceptedAuthenticationMethods NX-private-key

    I get ‘permission’ denied errors – note I am doing this as ROOT but I’m still unable to modify the file.

    Is NoMachine doing something strange with permissions or metadata? I’m really unable to edit this file even as root – very odd.

    How do i do this so that i can set key only auth?

    Thanks!

    #47166
    Britgirl
    Keymaster

    Please check that you actually have sudo privileges.

    Open a terminal and from CLI try to edit the file, for example with vim:

    sudo vim /Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg

    or just use command:

    sudo sed -i '' -e 's/^AcceptedAuthenticationMethods.*/AcceptedAuthenticationMethods NX-private-keytest/' "/Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg"

    This will change the key to:

    AcceptedAuthenticationMethods NX-private-key

    #47168
    horseman67
    Participant

    Thanks, but i’m 100% running this as root – there is some other strange setting nomachine has set (some SIP related thing?) that makes the files inaccessible even as root.

    Here’s the result of your command, you can see i’m running as root. I don’t have this problem with any other app, only NoMachine – my friends who also have NoMachine installed on mac get the same issue.

    /Applications/NoMachine.app/Contents/Frameworks/etc » sudo sed -i ” -e ‘s/^AcceptedAuthenticationMethods.*/AcceptedAuthenticationMethods NX-private-keytest/’ “/Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg”

    Password:

    sed: /Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg: Operation not permitted

    #47180
    zaq
    Participant

    Hello Horseman67,

    You need to grant Terminal.app ‘Full Disk Access’. Go to

    ‘System Settings’ -> ‘Privacy & Security’ -> ‘Full Disk Access’

    and then reopen Terminal.app and run:

    sudo sed -i -e
    "s/^AcceptedAuthenticationMethods.*/AcceptedAuthenticationMethods
    NX-private-keytest/"
    /Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg 
    #47181
    Britgirl
    Keymaster

    I just noticed a typo in the previous command I wrote, apologies for that. It should have been

    sudo sed -i '' -e 's/^AcceptedAuthenticationMethods.*/AcceptedAuthenticationMethods NX-private-key/' "/Applications/NoMachine.app/Contents/Frameworks/etc/server.cfg"

    #47250
    horseman67
    Participant

    @zaq

    Thanks that worked! Giving “full disk access” did it! I think this should be in the instructions!!!

Viewing 6 posts - 1 through 6 (of 6 total)

This topic was marked as solved, you can't post.