How to change /etc/passwd file permanently in pfsense2



  • Dear All,

    here below a short description of what I would like to achieve:

    I would like to use rssh to limit some user to get only sftp access and in jail chroot. So after configuring rssh.conf file I should change the default shell for the user I want to limit. Changing the shell means to change the /etc/passwd file but it is not possible because this file is overwritten by some script every time I reboot the machine.
    Where should I have a look in order to make permanent my change ?

    Thanks



  • run:

    
    chflags schg /etc/passwd
    
    

    …or have a script run @reboot in cron to cp the version you want over the system modified version



  • thank you for the suggestion. But by this way you cannot add any other user by the user manager web cfg gui.
    So it should be done in the cleanest possible way in order to not affect the system functionality.



  • Did you tried to use pw?



  • @saso:

    thank you for the suggestion. But by this way you cannot add any other user by the user manager web cfg gui.
    So it should be done in the cleanest possible way in order to not affect the system functionality.

    yes you can.

    open terminal.
    run 'chflags uchg /etc/passwd'
    add user via gui.
    then run 'chflags schg /etc/passwd'

    honestly how often are you adding users ?


  • Rebel Alliance Developer Netgate

    There is an scp only shell built into 2.0. Just add a user and give them only the "User - System - Copy files" permission.


Log in to reply