Issue #1053
closedExport to USB HDD on RHEL7 Fails
Description
This problem is observed on pulp 2.6.2 final (there is no 2.6.2 tag available in plan.io).
I plugged in a USB HDD and allowed Gnome 3 to auto-mount it for me. On RHEL7, the auto-mount path for hot-pluggable media is
/var/run/media/${USER}/${FS_LABEL}
Then I tried to export a repo to the external drive.
When I run the commands
pulp-admin $RepoType repo export run \
--repo-id=foreman \
--export-dir=/var/run/media/stanb/Linux_Mirrors/pulp_repos/foreman
the following output is obtained:
+----------------------------------------------------------------------+
Publishing Repository [foreman]
+----------------------------------------------------------------------+
The following publish configuration options will be used:
Export Dir: /var/run/media/stanb/Linux_Mirrors/pulp_repos/foreman
This command may be exited via ctrl+c without affecting the request.
Initializing repo metadata
[-]
... completed
Publishing Distribution files
[-]
... completed
Publishing RPMs
[==================================================] 100%
98 of 98 items
... completed
Publishing Delta RPMs
... skipped
Publishing Errata
[-]
... completed
Publishing Comps file
[-]
... completed
Publishing Metadata.
[-]
... completed
Closing repo metadata
[-]
... completed
Generating sqlite files
... skipped
Copying files
[-]
... failed
[Errno 13] Permission denied: '/var/run/media/stanb/Linux_Mirrors'
Task Failed
[Errno 13] Permission denied: '/var/run/media/stanb/Linux_Mirrors'
[stanb@bumblebee ~]$
I have instrumented the code at publish_step.py CopyDirectoryStep.process_main(self), and I have determined that the error is caused by the line
shutil.copytree(self.source_dir, self.target_dir, symlinks=self.preserve_symlinks)
The relevant entries and permissions at the error path are shown below:
[stanb@bumblebee ~]$ ls -al /var/run/media/stanb/Linux_Mirrors
total 68
drwxrwxrwx 7 root root 4096 Jun 11 18:30 .
drwxr-x---+ 3 root root 60 Jun 10 15:27 ..
drwx------ 2 root root 16384 Jun 3 2013 lost+found
drwxrwxrwx 2 stanb stanb 4096 Jun 11 18:31 pulp_repos
[stanb@bumblebee ~]$
mount shows the following mount options:
/dev/sdb1 on /run/media/stanb/Linux_Mirrors type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
I changed the mount options to remove the nosuid:
mount -o remount,suid /run/media/stanb/Linux_Mirrors/
Mount permissions are now
/dev/sdb1 on /run/media/stanb/Linux_Mirrors type ext4 (rw,nodev,relatime,data=ordered,uhelper=udisks2)
I still get the Errno 13 Permission denied.
I presume that the file copy is running within the context of the server. The server is running as user apache. These directories are writeable by 'other', so why is there a Permission Denied error? Perhaps this is an selinux problem?