1

Running programs as root is dangerous, What's the best way to create a new low privileged user for Irssi and ircd-hybird on Debian?

zotherstupidguy
  • 287
  • 1
  • 2
  • 9
  • running a program as root is not dangerous as long as you know what you are doing – Angs Jul 28 '13 at 01:38
  • 1
    @angs: That is bad security. If a program is vulnerable, an attacker may be able to execute arbitrary code with the privledges of the user running the program. –  Jul 28 '13 at 01:39
  • @Evan Teitelman, what I meant, I am not agreed with the generalization of the statement. Running a program as root is not always dangerous, If you know how to use a program, e.g. screen, would it be dangerous to connect my serial device via screen /dev/ttyUSB0 115200. – Angs Jul 28 '13 at 01:47
  • @angs: I see. I thought you were going for "it's not dangerous if you don't make mistakes." –  Jul 28 '13 at 01:49

1 Answers1

1

You can use the useradd command.

useradd -s /bin/false -g <primary_group> <username>

The -s flag sets the user's login shell. If the user does not need a shell, set its login shell to /bin/false or /bin/nologin.

If the user needs a home directory, you can use the -m flag to create one automatically. You can run programs as this user with sudo.

sudo -u <username> <program>