Não é possível descompactar um arquivo com o sudo cpio

0
I have sudo permissions and I'm trying to unpack a file with cpio command.
However, because of the path properties I get permission denied when I try to do it.

$ id
uid=4777(testuser) gid=100(users) groups=100(users),1008(otherwheel)

The home path has 700 permission:
$ sudo ls -ld /home/uadmin/
[sudo] password for testuser:

drwx ------. 16 uadmin uadmin 4096 dic 1 15:26 / home / uadmin /

The file has 775 permission:
$ sudo ls -l /home/uadmin/RH7HOTFIX/INSTALL
[sudo] password for testuser:

-rw-rw-r-- 1 raiz raiz 163840 abr 28 2016 / home / uadmin / RH7HOTFIX / INSTALAR

When I try to unpack the file I get 'permission denied':
$ sudo cpio -ivcBdum install</home/uadmin/RH7HOTFIX/INSTALL

-bash: / home / uadmin / RH7HOTFIX / INSTALL: permissão negada

I can´t change the path permission.
I can´t move the file because of the disk space.
I can´t use sudo -i for a new shell.

My OS is Red Hat Enterprise 7.2

Any ideas?
Thanks in advanced.
DASM
    
por The-0m3n 20.12.2016 / 23:58

1 resposta

1

o redirecionamento do sudo e do shell está quebrado

Eis uma boa explicação e algumas soluções alternativas:

Your command does not work because the redirection is performed by your shell which does not have the permission to write to [the file]. The redirection of the output is not performed by sudo.

  1. Run a shell with sudo and give the command to it by using the -c option
  2. Create a script with your commands and run that script with sudo
  3. Launch a shell with sudo -s then run your commands
  4. Use sudo tee (if you have to escape a lot when using the -c option)

7-zip

Como alternativa, você pode descompactar o arquivo usando um programa que não requer redirecionamento de shell, como 7-zip , que deve estar disponível para o RHEL 7 via rpmforge.

Aqui está um como :

  1. Download the repo using the command given below.

sudo wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

  1. Now install the downloaded rpm using

sudo rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

  1. Now you need to install the package

sudo yum install p7zip

  1. To unzip the file use the following command

sudo 7za x <filename>

    
por 21.12.2016 / 00:13