Page MenuHomePhabricator

Remove trailing slashes in LDAP's service user homedirs
Closed, ResolvedPublic

Description

local-betacommand-dev@tools-login:~$ cd svn_copy
local-betacommand-dev@tools-login:/data/project/betacommand-dev/svn_copy$

as soon as you leave the root of $HOME the full path is displayed. Traditionally /data/project/betacommand-dev (in my case) is just displayed as ~ while SSHing. Right now between the username/hostname/directory half my terminal is eaten


Version: unspecified
Severity: trivial

Details

Reference
bz54074

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:12 AM
bzimport added a project: Toolforge.
bzimport set Reference to bz54074.

This is confined to tool accounts and the first prompt after become'ing a tool account seems to work:

local-wikilint@tools-login:~$ PS1='\w: '
~: cd cgi-bin
/data/project/wikilint/cgi-bin: cd
/data/project/wikilint:

Further digging indicates that the trailing slash in $HOME is the culprit:

/data/project/wikilint: echo $HOME
/data/project/wikilint/
/data/project/wikilint: HOME=/data/project/wikilint
~: cd cgi-bin
~/cgi-bin:

I don't know if there is a deeper reasoning behind that slash or if that was just an oversight, but fixing this probably requires fiddling with the LDAP database.

Changing the homes in LDAP might be more involved than necessary (and may have side effect).

I did put a workaround in /etc/profile to strip the slash on login sessions.

Looking at https://wikitech.wikimedia.org/w/index.php?title=Special:NovaProject&action=configureproject&projectname=tools, the service user homedir pattern is set to "/data/project/%u", so no trailing slashes shouldn't have a side effect.

So we should just clean up the database once and remove the workaround then.

Andrew, Ryan, we need:

  • For all service users in the Tools project,
  • if the homedir has a trailing slash,
  • remove it.

Actual output at the moment is:

scfc@tools-login:~$ getent passwd local-wikilint
local-wikilint:x:50420:50420:local-wikilint:/data/project/wikilint/:/bin/bash
scfc@tools-login:~$

Expected output is:

scfc@tools-login:~$ getent passwd local-ggu
local-ggu:x:50961:50961:local-ggu:/data/project/ggu:/bin/bash
scfc@tools-login:~$

The move to eqiad has solved this:

scfc@tools-login:~$ getent passwdgrep '^tools\.'cut -d : -f 6grep '/$'
scfc@tools-login:~$

The workaround is also gone, thus closing the bug.