[Solved] /etc/passwd changes with resets

Any questions about the Command Line Interface can be placed here!
Forum rules
1) On 12/25, Synology Forums will be getting a new layout. During this time, content will still be accessible but you will be unable to make new threads and posts.

2) This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form:

3) To avoid putting users' DiskStation at risk, please don't paste links to any patches provided by our Support team as we will systematically remove them. Our Support team will provide the correct patch for your DiskStation model.
I'm New!
I'm New!
Posts: 5
Joined: Sat Jun 17, 2017 9:55 pm

[Solved] /etc/passwd changes with resets

Postby 35mal3 » Sat Jun 17, 2017 10:11 pm

Hi there,

first post. I use a DS216+II and try to configure it as a backup solution for several linux clients.
Client side I use Duplicity, created a pretty isolated backup user on the NAS and log in with a
private key via SSH. So far so good.

The problem: When I restart my NAS, "/etc/passwd" changes the login shell for my backup user
from "/bin/sh" to "/sbin/nologin" automatically. So my cron jobs on my linux clients won't work anymore
because I can't login via SSH to my backup-user.

What I read is: I could change the user to a UID lower than 1024 to make it a system user. But how
do I do that without "usermod" installed? Is there a solution to change UIDs on DSM 6.1 (i think)?
Or, even better, to keep "/etc/passwd" from being overwritten by restarts? Thanks!
Last edited by 35mal3 on Wed Jul 05, 2017 8:07 am, edited 1 time in total.
I'm New!
I'm New!
Posts: 5
Joined: Sat Jun 17, 2017 9:55 pm

Re: /etc/passwd changes with resets

Postby 35mal3 » Wed Jun 21, 2017 8:26 am

So to answer my own question, I wrote a startup script "99passwd.sh" and put it in "/usr/local/etc/rc.d/".
It basically replaces the standard entry ("/sbin/nologin") for my backup user "archive" in "/etc/passwd"
with the slightly changed entry "/bin/sh".

For the script to run, user has to do a:
"chmod u+x /usr/local/etc/rc.d/99passwd.sh"

Code: Select all

# Keep /bin/sh as login shell
# for a normal user with a UID bigger than 1024

# Synology Default Entry

# Changed Entry

# Check if "/sbin/nologin" is set ands if so...
NOLOGIN=$(grep "${PWUSER}" /etc/passwd)

case $1 in

    if [ "${NOLOGIN}" ]; then
        # ...backup /etc/passwd...
        cp /etc/passwd /etc/passwd_BACKUP
        # ...replace line with changed entry
        sed -i 's/'"${PWUSER}"'/'"${CHUSER}"'/' /etc/passwd


    echo "Do nothing"
I'm New!
I'm New!
Posts: 1
Joined: Sat Aug 12, 2017 3:35 pm

Re: [Solved] /etc/passwd changes with resets

Postby raydenz » Sat Aug 12, 2017 3:41 pm


Someone have a better solution?
I think your solution works but it is dirty.. :roll:



Return to “Command Line Interface”

Who is online

Users browsing this forum: No registered users and 1 guest