I want to use a system user to separate permissions when I run nodejs scripts.
I created node-user
:
sudo useradd -r -m node-user
Then I expected that next command login me in shell node-user
:
sudo -u node-user -s
But seems that it's uses my var environment:
node-user@host:~$ echo $HOME
> /home/me
Why? On CentOS 7 it's print /home/node-user
.
I know that I can to set password for node-user
and login like this:
su - node-user
But for me it's not logical, because node-user
it's system user and may not have a password.
sudo -H -u node-user -s
and all works fine. – ktretyak Dec 10 '19 at 20:47