Sponsored Content
Top Forums UNIX for Advanced & Expert Users CentOS7 restoring file capabilities Post 303025738 by Peasant on Sunday 11th of November 2018 02:19:53 AM
Old 11-11-2018
Give this a shot, i've tried it in KVM box with success.
Code:
[root@proxygw ~]# uname -a
Linux proxygw 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@proxygw ~]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core) 
[root@proxygw ~]# getcap /usr/bin/ping
/usr/bin/ping = cap_net_admin,cap_net_raw+p
[root@proxygw ~]# cat rb.sh
tar --acl --selinux --anchored --xattrs --xattrs-include='security.capability' -cvpzf - /usr/bin/ping | ( cd /tmp && tar -xzvp --acl --selinux --anchored --xattrs --xattrs-include='security.capability' -f - )
[root@proxygw ~]# ./rb.sh
tar: Removing leading `/' from member names
/usr/bin/ping
usr/bin/ping
[root@proxygw ~]# getcap /usr/bin/ping /tmp/usr/bin/ping 
/usr/bin/ping = cap_net_admin,cap_net_raw+p
/tmp/usr/bin/ping = cap_net_admin,cap_net_raw+p

Hope that helps
Regards
Peasant.
These 2 Users Gave Thanks to Peasant For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Restoring a file from Tape

help please i have "inherited" a Sco Server (the administrator departed in a hurry...yes we are chasing him..) and haven't used Unix for 8 years. i have a file that i need to retrieve from a tape. i have been able to find the file on tape using the cpio -ivt command. however... the problem I... (3 Replies)
Discussion started by: mfischer
3 Replies

2. UNIX for Dummies Questions & Answers

Restoring a single file...???

Can anyone please help...? Managed to do a ufsdump of files to tape. Having trouble using ufsrestore to pull a single file back by filename?? I have dumped a single file to tape also because looking through the other threads, I noticed that you have to tell it to skip files before you get to... (1 Reply)
Discussion started by: Jonathan
1 Replies

3. Solaris

Restoring TAR'd file to different location

Is it possible to restore a TAR'ed file off of a tape to a location other than the original location? If so, how? (The MAN pages give examples of how to restore only to the originating location.) Thanks!! (1 Reply)
Discussion started by: FredSmith
1 Replies

4. Shell Programming and Scripting

Restoring a file

I'm new to Unix and have just wrote a little program to move files to a recycle bin (a Directory i created) and restore them. The problem is that i need to keep track of all the full filenames so that i can restore them to the right place. I did this by creating a file called delreg and putting the... (4 Replies)
Discussion started by: zoolz
4 Replies

5. UNIX for Dummies Questions & Answers

Restoring back a deleted file in unix.

Hi, Can any one tell me how to restore back the deleted file in unix? I know the file name. If i know the inode number of the file does help more to restore back the file? (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

6. Shell Programming and Scripting

restoring file to its default location...

Hello everyone, I am new to unix shell. I have a file called Path.txt....and i have data in that as 1 abhi 2 avi 3 ash so on..... 1 ,2 ,3 is the... (2 Replies)
Discussion started by: AbhijitIT
2 Replies

7. Solaris

Restoring a Root File System that was on a metadevice

Hello I use Solaris 10. I need to restore the root file system, but I don't know how . i can only boot the server in safe mode or with the cd (ok boot cdrom -s) Do you guys know a good procedure, I don't want to break the mirrors. ( the server is not a cluster). Its an emergency, i would... (4 Replies)
Discussion started by: feg
4 Replies

8. Red Hat

Issues restoring a large dump file

Post deleted. (0 Replies)
Discussion started by: Nobody_knows_me
0 Replies

9. Shell Programming and Scripting

Restoring a file to its original location

Hello everyone, I am attempting to make a recycling bin type application in shell script (tcsh). I have the whole part of the application done where someone can recycle files from one location to the recycling bin (the lower half of the program), this is not a problem. However I wanted to make... (7 Replies)
Discussion started by: tastybrownies
7 Replies

10. UNIX for Dummies Questions & Answers

Restoring deleted file with rm -rf

Is there a way I could recover a deleted text file with "rm -rf" command. Running CentOS 6.5. Thank you. (5 Replies)
Discussion started by: galford
5 Replies
FILECAP:(8)						  System Administration Utilities					       FILECAP:(8)

NAME
filecap - a program to see capabilities SYNOPSIS
filecap [ -a | -d | /dir | /dir/file [cap1 cap2 ...] ] DESCRIPTION
filecap is a program that prints out a report of programs with file based capabilities. If a file is not in the report or there is no report at all, no capabilities were found. For expedience, the default is to check only the directories in the PATH environmental variable. If the -a command line option is given, then all directories will be checked. If a directory is passed, it will recursively check that directory. If a path to a file is given, it will only check that file. If the path to the file includes capabilities, then they are written to the file. OPTIONS
-a This tells the program to show all capabilities starting from the / directory. Normally the PATH environmental variable is used to show you capabilities on files you are likely to execute. -d This dumps all capabilities for reference. EXAMPLES
To check file capabilities in $PATH: filecap To check file capabilities of whole system: filecap -a To check file capabilities recursively in a directory: filecap /usr To check file capabilities of a specific program: filecap /bin/passwd To list all possible capabilities: filecap -d To set a file capability on a specific program: filecap /bin/ping net_raw net_admin SEE ALSO
pscap(8), netcap(8), capabilities(7). AUTHOR
Steve Grubb Red Hat March 2009 FILECAP:(8)
All times are GMT -4. The time now is 02:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy