Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to change /etc/passwd file permanently in pfsense2

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 4 Posters 2.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      saso
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • E
        ericab
        last edited by

        run:

        
        chflags schg /etc/passwd
        
        

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

        1 Reply Last reply Reply Quote 0
        • S
          saso
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • marcellocM
            marcelloc
            last edited by

            Did you tried to use pw?

            Treinamentos de Elite: http://sys-squad.com

            Help a community developer! ;D

            1 Reply Last reply Reply Quote 0
            • E
              ericab
              last edited by

              @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 ?

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

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

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.