moby: su in centos returns "could not open session"

I build a hadoop docker based on the centos image in this repo. For security reasons, hadoop make the permisson of hdfs command to user “hdfs” by default. When I tried to run the hdfs commands as user hdfs by su like:

#su hdfs hdfs dfs -mkdir /user

the system refused me of changing user with message “could not open session”.

The interesting phenomenon is that when I created a user by useradd ambling && su ambling, there was no error at all and I successfully changed to ambling.

After some search, I edited the file ** /etc/pam.d/su ** and changed the session part of “include” to optional, then I can use su to change to hdfs.

I don’t know the exact reason for this error or whether there may be some side effect to my solution. I guess that the cause may be some misses of necessary part in the centos kernel in the process of building the official centos base image.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 25 (4 by maintainers)

Commits related to this issue

Most upvoted comments

spira:hadoop jperrin$ docker run -t -i -h hadooptest --name hadooptest hadoop-test:base bash-4.1# su - hdfs could not open session bash-4.1# exit

so, this fails, however ->

spira:hadoop jperrin$ docker run --privileged=true -t -i -h hadooptest --name hadoopfoo hadoop-test:base bash-4.1# su - hdfs -bash-4.1$

that works fine.

spira:hadoop jperrin$ boot2docker version Client version: v1.1.1 Git commit: 8dd1935