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

Running tmate-slave as non-root user #40

Open
siddharth99 opened this issue Jul 11, 2018 · 2 comments
Open

Running tmate-slave as non-root user #40

siddharth99 opened this issue Jul 11, 2018 · 2 comments

Comments

@siddharth99
Copy link

I wanted to confirm what all steps need to be taken to run tmate server without root privileges; I am able to compile file and run using a random large port but when I try to access this tmate server by creating a tmate session I get - fatal: Need root priviledges

As far as I understand I should be able to run without root as long as I'm not interested in using port 22.

@jwhett
Copy link

jwhett commented Dec 3, 2018

I yield to the maintainers and their recommendations, but here's a stab at some things to look into...

Source modification

Changing the port and removing root

You might be interested in the following lines of tmate.h:

#ifdef DEVENV
#define TMATE_SSH_DEFAULT_PORT 2200
#else
#define TMATE_SSH_DEFAULT_PORT 22      // <--- This
#endif

Removing root requirement

You would also need to comment this out in tmate-slave.c in jail():

      if (getuid() != 0)
                tmate_fatal("Need root priviledges");

Notes:

  • Perhaps make a block in your ~/.ssh/config to make connecting to a non-standard Port for that host easier.

No source modification

Config

Change the port in ${TMATE_DIR}/.tmate.conf:

set -g tmate-server-port 2222

Kernel Capabilities

If you must run something below 1024 without root, you might want to have a look at kernel capabilites. Specifically cap_net_bind_service.

Notes:

  • you'll need root to set the capabilities
  • any modifications to the tmate-slave executable will erase any capabilities you've set.
  • you may need more than just that capability to run the service entirely without root, but it's a place to start 😉

Good luck!

@whereswaldon
Copy link

In addition to what @jwhett said above, you need these capabilities on the binary:

$ getcap tmate-slave
tmate-slave = cap_setgid,cap_setuid,cap_net_bind_service,cap_sys_chroot,cap_sys_admin+ep

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

3 participants