Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie questions and feature requests #101

Open
dumblob opened this issue May 4, 2022 · 3 comments
Open

Newbie questions and feature requests #101

dumblob opened this issue May 4, 2022 · 3 comments

Comments

@dumblob
Copy link

dumblob commented May 4, 2022

I'll simply list what surprised me, a cpu noob 😉. Could you comment on each of the points?

  1. Running cpud on a Linux machine requires PID 1 - why? Shouldn't root privileges be enough? This makes it impossible to run on pretty much any ordinary Linux distribution (which I'd say defeats the major use case "to seamlessly perform work on running remote machines").
  2. Running cpud -remote on a Linux machine does run the daemon but in addition to that it executes an interactive shell 😮 - why the shell?
  3. cpu doesn't seem to support any way to specify the user to be used to execute the given command at the remote host if the host supports it (yes, this might be a "too high level" request for cpu/cpud but I stand at it as otherwise this again defeats the purpose of using cpu with ordinary running remote machines like Linux/BSD).
  4. On a Linux machine running cpud -remote (I've tried both as root and as a non-root user) and then in another terminal cpu localhost /bin/bash only returns the error 2022/05/04 10:56:43 SSH error Failed to dial: dial tcp [::1]:23: connect: connection refused instead of connecting to the running daemon (and no, there is no firewall on port 23 nor any running SSH daemon nor anything else). Why doesn't this simple case work?

Thanks for explanations, suggestions, etc.!

@Rubo3
Copy link

Rubo3 commented May 27, 2022

  1. Running cpud on a Linux machine requires PID 1 - why? Shouldn't root privileges be enough? This makes it impossible to run on pretty much any ordinary Linux distribution (which I'd say defeats the major use case "to seamlessly perform work on running remote machines").

You can run cpud -d -init, especially if you use systemd.

@dumblob
Copy link
Author

dumblob commented May 27, 2022

Thanks for the suggestion @Rubo3 . What is it expected to do? On the Linux machine I currently sit in front of (Arch Linux with systemd), this is what happens (i.e. the daemon doesn't run neither in foreground nor in background):

0$ sudo systemctl status sshd
○ sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor pres>
     Active: inactive (dead) since Fri 2022-05-27 09:53:38 CEST; 1min 11s ago
    Process: 589 ExecStart=/usr/bin/sshd -D (code=exited, status=0/SUCCESS)
   Main PID: 589 (code=exited, status=0/SUCCESS)
        CPU: 149ms
...
$
$ ps -Afl | grep -Ei cpud
0 S xxx    3573884 3573065  0  80   0 -  2627 -      09:50 pts/2    00:00:00 grep --color=auto -Ei cpud
$ echo $?
0
$ cpud -d -init
2022/05/27 09:50:23 
CPUD:Args [cpud -d -init] pid 3573910 *runasinit true *remote false
2022/05/27 09:50:23 
CPUD:Running as Init
2022/05/27 09:50:23 
CPUD:Kicked off startup jobs, now serve ssh
2022/05/27 09:50:23 
CPUD:Start the process reaper
2022/05/27 09:50:23 CPUD:starting ssh server on port 23
2022/05/27 09:50:23 CPUD:err listen tcp :23: bind: permission denied
2022/05/27 09:50:23 
CPUD:server.ListenAndServer returned
2022/05/27 09:50:23 CPUD: All startup jobs exited
2022/05/27 09:50:23 CPUD: Syncing filesystems
2022/05/27 09:50:23 
CPUD:Reaped 1 procs
$ echo $?
0
$ ps -Afl | grep -Ei cpud
0 S xxx    3573939 3573065  0  80   0 -  2627 -      09:50 pts/2    00:00:00 grep --color=auto -Ei cpud
$ echo $?
0

@dumblob
Copy link
Author

dumblob commented May 27, 2022

Ok, cpud -d -init under root seems to fix the bind issue and I can connect with cpu localhost on the same machine. Thanks for the pointer!

Would you know something about the other points?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants