lxc-attach runs in wrong container directory

Bug #1459751 reported by David Favor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Won't Fix
Medium
Unassigned

Bug Description

net8-rmt# lxc-attach -n test -- bash -c 'id && egrep ^root /etc/passwd && echo ~ && echo $HOME && pwd'
uid=0(root) gid=0(root) groups=0(root)
root:x:0:0:root:/root:/bin/bash
/root
/root
/

Notice pwd show / instead of /root which is incorrect + causes all manner of confusion when debugging path related problems.

net8-rmt# uname -a
Linux ns515383.ip-167-114-159.net 3.19.0-18-generic #18-Ubuntu SMP Tue May 19 18:31:35 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

net8-rmt# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid

Same behavior with containers created with precise through wily releases.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Interestingly, while the programmatic attach (in the API) supports a initial_cwd argument, the lxc-attach program does not.

The current logic is - if inital_cwd is specified, it is used. Otherwise,
you are placed in your current directory if it exists, else container root.

It probably would be best to have lxc-attach place you in the user's
homedir on login, although it may be hard to make such a change now
without upsetting existing scripts.

Changed in lxc (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Christian Brauner (cbrauner) wrote :

I don't think we can change this behavior since too many users might rely on this.

Changed in lxc (Ubuntu):
status: Confirmed → Won't Fix
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.