Create my own System-User via useradd?

Hello,
I need a separate (S)FTP user (or SSH user if applicable). This type of user cannot be created via the YunoHost interface. If I create such a user via terminal with the command useradd, will that cause complications with the YunoHost system? - The background is that I need a separate user for the file upload in my Pico-CMS.
Thanks for your help
Tinder

YunoHost-Version: 11.2.4 (stable)


Hallo,
ich benötige einen separaten (S)FTP-User (bzw. ggf. auch SSH-User). Diese Art von Nutzern kann man ja nicht über das YunoHost-Interface anlegen. Wenn ich so einen User per Terminal mit dem Kommando useradd anlege, gibt das Komplikationen mit dem YunoHost-System? - Hintergrund ist, dass ich einen separaten User für den Datei-Upload in meinem Pico-CMS benötige.
Danke für eure Hilfe
Tinder

YunoHost-Version: 11.2.4 (stable)

Why ? You can create a user in YunoHost and then give him SSH and SFTP right. See SSH and command line | Yunohost Documentation

1 Like

This can be integrated from the app packaging.

If you want to do it manually:

sudo useradd -aG sftp.app pico
sudo passwd pico
# assign a strong password to the user 

User pico will then have the right to log in via SFTP.

3 Likes

Oh, yeah! This looks quite good - thank you :slight_smile:
But one little question remains: At this moment the user has only access to /home/picouser. How can I change users home-dir to the pico-web-path (/var/www/pico/content)? And how can I give him access to this folder? I need already “su” to access the /var/www/-folder…

The useradd-command does not seem to know the option “-a”. Did the “a” accidentally slip between “-” and “G” or does the “a” stand for another letter?

Try something like

sudo chown -R picouser:picouser /var/www/
1 Like

Yes, ok thanks - the basic principle is clear. My concern is that if I do a chmod on /var/www/pico/content, the YunoHost system might be disturbed. Do you know more about this?

It might be -a -G, the -a is important to append the group to the user’s existing group list, otherwise it is replaced. This might explain why you cannot access to /var/www/pico correctly. Check its groups with groups pico.

I think I forgot to ensure the user’s home directory: sudo usermod -d /var/www/pico pico (I discourage you from choosing directly a subdirectory, just a feeling).

1 Like

Ah, ok - that explains a lot :slight_smile:
Thank you very much, I’ll try that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.