2

And here it is, another permission denied, sorry for that, but I cannot get it running.

Let me be a stack user with sudo permissions, so that I can create a folder x by sudo mkdir /root/x. That's running fine. But I get permission denied without sudo, no matter what I try. I set chown -R stack:stack /root, and chmod 777 /root, but still cannot create a subfolder:

stack@2d11fb64044f:/$ whoami
stack
stack@2d11fb64044f:/$ ls -l / | grep stack
drwxrwxrwx   6 stack stack 4096 Sep 27 23:11 root
stack@2d11fb64044f:/$ ls /root
local.conf  logs  run.sh
stack@2d11fb64044f:/$ mkdir /root/x
mkdir: cannot create directory '/root/x': Permission denied

How to set /root folder permissions for stack user to be able to create a new subfolder in /root? It's Ubuntu 14.04 docker image.

Edit: Replicate with docker:

 x:\>docker run -it ubuntu:14.04 /bin/bash
 root@c4d9e561f4e8:/# adduser stack
 Adding user `stack' ...
 Adding new group `stack' (1000) ...
 Adding new user `stack' (1000) with group `stack' ...
 Creating home directory `/home/stack' ...
 Copying files from `/etc/skel' ...
 Enter new UNIX password:
 Retype new UNIX password:
 passwd: password updated successfully
 Changing the user information for stack
 Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
 Is the information correct? [Y/n] y
 root@c4d9e561f4e8:/# chown stack /root
 root@c4d9e561f4e8:/# su - stack
 stack@c4d9e561f4e8:~$ mkdir /root/x
 mkdir: cannot create directory '/root/x': Permission denied
  • 3
    I wouldn't mess with the permissions of the /root folder, instead, I'd give the appropriate permissions to stack – cutrightjm Sep 28 '16 at 0:38
  • what permissions do you have in mind? – jan.supol Sep 28 '16 at 0:45
  • 2
    Why exactly do you want this folder to reside in /root when you could put it anywhere else? – cutrightjm Sep 28 '16 at 1:01
  • 1
    This is so weird. I dropped the ubuntu image, I pull it over again, and get the same permission denied (nothing done in between). It's windows 7/VirtualBox&boot2docker. Tried with my second machine, and it works as you describe. The only difference I can see is the second machine is having docker in windows 10/hyper-V. I suspect this can have something to do with this bug. – jan.supol Sep 28 '16 at 16:55
  • 1
    @techraf: Can reproduce OP's behavior on Ubuntu14.04(Docker)@Ubuntu16.04(Host) with a fresh container/image. – Zeta Sep 29 '16 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.