logname returns "logname: no login name" with gnome-terminal

Bug #1537645 reported by Justin Luth
42
This bug affects 9 people
Affects Status Importance Assigned to Milestone
gnome-terminal (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Logname fails to return a login name in Xenial Unity. I expected it to return my login name (especially when running as "sudo"). Strangely, it works in gnome-shell and mate editions of Xenial.

It is only a problem with gnome-terminal. It works in xterm and uxterm and in tty1...

Ubuntu Xenial Xerus (development branch) Release 16.04.

logname is unique because it returns the underlying username (and not root) when in sudo mode, so this utility is fairly critical and cannot be substituted with whoami or id -un or any other command that I know of.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :
Justin Luth (jluth)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-terminal (Ubuntu):
status: New → Confirmed
Revision history for this message
Rael Gugelmin Cunha (rael-gc) wrote :

If I correctly understood, based on the link pasted by Edgmont, gnome terminal is no more writing a utmp entry when called as a login shell.

Revision history for this message
Tres Finocchiaro (tres-finocchiaro) wrote :

For those looking for an alternative to logname, $SUDO_USER works pretty well. http://askubuntu.com/a/849469/412004

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.