lxc-attach runs in wrong container directory
Bug #1459751 reported by
David Favor
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:
/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.
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.
To post a comment you must log in.
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.