Sudo systemctl start sshd?

|
smol_mazunki 2022-08-18 16:14:54
btw, remember to set the main shell of the git user to git-shell
min 2022-08-18 16:18:51
Maybe I put it wrong. The question is why if start sshd like /sbin/sshd it works fine, but is I start systemctl start sshd it ask me a password?
min 2022-08-18 16:19:08
smol_mazunki 2022-08-18 16:14:54
btw, remember to set the main shell of the git user to git-shell

git is just a user

min 2022-08-18 16:19:25
like any other
smol_mazunki 2022-08-18 16:21:49
min 2022-08-18 16:19:08
git is just a user

shouldn’t be, there’s no reason to log in to that user

smol_mazunki 2022-08-18 16:23:08
min 2022-08-18 16:18:51
Maybe I put it wrong. The question is why if start sshd like /sbin/sshd it works fine, but is I start systemctl start sshd it ask me a password?

systemctl is a wrapper, usking polkit (presumably) to authenticate and run the service as root

smol_mazunki 2022-08-18 16:23:42
when you run sshd in the shell manually you’re running it as a user, and thus don’t need to authenticate as root
smol_mazunki 2022-08-18 16:23:55
you /should/ run the service as root
min 2022-08-18 16:43:44
smol_mazunki 2022-08-18 16:23:55
you /should/ run the service as root

Why..?

smol_mazunki 2022-08-18 16:44:26
min 2022-08-18 16:43:44
Why..?

because no user should have the privilege of opening the door to your system

min 2022-08-18 16:44:57
sudo systemctl start sshd?
ufoludek 2022-08-18 16:44:58
min 2022-08-18 16:18:51
Maybe I put it wrong. The question is why if start sshd like /sbin/sshd it works fine, but is I start systemctl start sshd it ask me a password?

Because systemctl services run as root by default

ufoludek 2022-08-18 16:45:05
If you want to start something as user you can use a parameter
ufoludek 2022-08-18 16:45:07
–user
smol_mazunki 2022-08-18 16:46:09
ufoludek 2022-08-18 16:44:58
Because systemctl services run as root by default

reason number 6969129 to not use systemd

ufoludek 2022-08-18 16:46:15
ufoludek 2022-08-18 16:44:58
Because systemctl services run as root by default

Unless some specific processes aren’t set to run as user

ufoludek 2022-08-18 16:46:18
Like pipewire etc.
smol_mazunki 2022-08-18 16:46:20
because it confuses users by doing unintuitive wrappers like this
ufoludek 2022-08-18 16:46:42
smol_mazunki 2022-08-18 16:46:20
because it confuses users by doing unintuitive wrappers like this

I’m not a systemd hater

ufoludek 2022-08-18 16:46:45
But I’m not a systemd fan
smol_mazunki 2022-08-18 16:46:48
fair enough
min 2022-08-18 16:46:50
I want ssh server. How to start it? How to add to autorun?
ufoludek 2022-08-18 16:46:50
I use it, it’s comfortable
smol_mazunki 2022-08-18 16:46:56
ufoludek 2022-08-18 16:46:50
I use it, it’s comfortable

agree

smol_mazunki 2022-08-18 16:47:02
it’s nice if you want something which just works
ufoludek 2022-08-18 16:47:10
Especially networkd recently
ufoludek 2022-08-18 16:47:13
I also used their bootloader
smol_mazunki 2022-08-18 16:47:17
also it’s fairly easy to set up a service
smol_mazunki 2022-08-18 16:47:22
and it /mostly/ just works
ufoludek 2022-08-18 16:47:27
But I use grub now because systemd-boot doesn’t support boot on lvm
smol_mazunki 2022-08-18 16:47:37
min 2022-08-18 16:46:50
I want ssh server. How to start it? How to add to autorun?

sudo systemctl sshd start gg wp you’re done

ufoludek 2022-08-18 16:48:03
Wrong syntax though
smol_mazunki 2022-08-18 16:48:04
if you want to autostart the server, sudo systemctl sshd enable
ufoludek 2022-08-18 16:48:07
Start before the service name
smol_mazunki 2022-08-18 16:48:18
ufoludek 2022-08-18 16:48:07
Start before the service name

right

|