My OSMC RPi is running SSH, FTP, Samba and Transmission services and I plan to access these services from my LAN, or from outside (using a RPi hosted VPN for Samba). I don’t want my roommates (on my LAN) to “inadvertently” access all my files, and since the Internet is dark and full of terrors, I’d like to add some security to my setup by not using the default username and passwords, and different usernames/password from service to service.
osmc user would still be active, but we couldn’t log in to ssh/ftp/samba etc with it anymore.
I think I find ways to do this, but I was wondering if doing this was meant to cause issues considering how OSMC works.
Thanks in advance,
EDIT: SOLVED thanks to DBMandrake: adduser should be used instead or useradd
Login as user osmc and run
and set a new password for the user osmc - nothing will happen to your install.
To add new users run the command
and answer the following questions.
You can do this as often as you like, you can also manually grant sudo rights to new users.
Hi, thanks for your answer.
I just created a new user for SSH, and only allowed him for SSH connections.
Everytime I log in, I get the message: -sh: 1: /etc/profile.d/add-paste.sh: Syntax error: Bad function name
I noticed that no /home/sshuser was created, I ran mkdir /home/sshuser and tried to cp .bashrc .bash_logout .profile from osmc user folder to sshuser user folder but it didn’t fix it.
Is there a way to fix this ?
EDIT: One serious issue I’m having with this user: some commands can’t be run from him (like sudo useradd someotheruser) even though this user has sudo rights: I get the output “-sh: 1: useradd: not found”
You should have used useradd, not adduser to create your new user.
adduser does not set up home directories etc and purely adds a user account in the passwd file.
I did use useradd and not adduser.
The first time I ran it with -M argument (do not create a personnal folder).
I have now logged back in SSH with osmc user, ran the following commands, and it’s still isn’t working (no personnal folder created, and I still get the output “sh: 1: /etc/profile.d/add-paste.sh: Syntax error: Bad function name”
sudo useradd userssh
sudo passwd userssh
sudo usermod -aG sudo userssh
EDIT: I tried creating yet another couple of users with useradd -m test2 (successfully created a /home/test2 user folder with the skeleton copied from /etc/skel.
And I also tried useradd -m -k etc/profile.d test3 to copy these files to my /home/test3, however I’m still getting the error " /etc/profile.d/add-paste.sh: Syntax error: Bad function name" and still can’t run some command with sudo
Sorry my mistake, the correct command is ‘adduser’ not ‘useradd’ as pointed out by Fry7. (I always get those two mixed up…)
I was able to reproduce your problem when I used useradd, however when I deleted the account with ‘userdel’ and recreated it with ‘adduser’ the home directory was created properly and the shell was set properly, so no error relatingto add-paste.sh etc…(This error is because add-paste.sh requires /bin/bash not /bin/sh to work properly)
So I would suggest you delete the user account and re-add it the correct way.
I just wanted to let you know that indeed it worked when using adduser, thanks a lot, I’ll mark my topic as solved