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

logname: no login name #7006

Open
1 task done
rlesac opened this issue Apr 7, 2024 · 5 comments
Open
1 task done

logname: no login name #7006

rlesac opened this issue Apr 7, 2024 · 5 comments

Comments

@rlesac
Copy link

rlesac commented Apr 7, 2024

Creating a bug report/issue

  • I have searched the existing open and closed issues

Required Information

  • DietPi version |
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=2
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH='master'
    G_GITOWNER='MichaIng'

  • Distro version |bookworm 1

  • Kernel version | Linux DietPi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux

  • SBC model | RPi B (armv6l)

  • Power supply used | 2A noname

  • SD card used | 2gb noname

Additional Information (if applicable)

  • Can this issue be replicated on a fresh installation of DietPi?
    Yes
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. install dietpi
  2. adduser myuser
  3. ssh from cygwin or wsl2
  4. type logname

Expected behaviour

  • logname should return the current username

Actual behaviour

  • logname: no login name

Extra details

  • I used default settings, except using static IP, and choosing to remove wireless support. I also chose to install vim tiny
  • I get the same result with root
  • whoami and w work normaly
  • tried ssh -T per online suggestions, won't login at all
@Joulinar
Copy link
Collaborator

Joulinar commented Apr 7, 2024

If I'm not mistaken, logname expecting a tty session which ssh normally does not provide.

@rlesac
Copy link
Author

rlesac commented Apr 8, 2024

I could not install various software I needed to run on the Raspberry pi because of it.
I got a hint that it is SSH related and switched from Dropbear to OpenSSH, and it's now working.

@MichaIng
Copy link
Owner

MichaIng commented Apr 8, 2024

logname returns the name of the user logged in based in /var/run/utmp, ignoring sudo/runuser and possible subshells. Dropbear seems to not create that entry, similar to how it does not use all PAM features etc. One can check the w command for registered login sessions.

To be true, I never heard of this command before, but $USER, $LOGNAME variables or whoami command. As you say "various software", which software exactly requires the logname command to be installed?

@rlesac
Copy link
Author

rlesac commented Apr 9, 2024

logname returns the name of the user logged in based in /var/run/utmp, ignoring sudo/runuser and possible subshells. Dropbear seems to not create that entry, similar to how it does not use all PAM features etc. One can check the w command for registered login sessions.

To be true, I never heard of this command before, but $USER, $LOGNAME variables or whoami command. As you say "various software", which software exactly requires the logname command to be installed?

It's https://github.com/Stefal/rtkbase

@MichaIng
Copy link
Owner

MichaIng commented Apr 9, 2024

I see. It uses bash for the installer, and suggests to run it with sudo, so a failsafe replacement (or fallback) for logname would be $SUDO_USER, else $USER variables, which is assured to be set in bash, hence also makes this "empty value" check obsolete.

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

No branches or pull requests

3 participants