Re: chmod 666 ///

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  I had to deal with a similar scenario where ownership was changed with
>  -R.  Fortunately I used an identical system (benefits of a classroom
>  environment) to create a baseline file containing the list of files on
>  the system and their ownersand groups.  Pumped that through a simple
>  script and restored ownership on all the files.  You could do
>  something similar with permissions if you had a baseline system.
>
>  But Andrew's suggestion sounds easier if that will work.
>
>  Jacques B.
>

A quick test and I have the following suggestion if you can't find any
other suitable one.  Run the following find command (as root)on your
system folders (i.e. /etc, /boot, /bin, /var).

find /etc -printf "%h/%f*%m\n" >/path-to-removable-drive/etc_files.txt
2>/dev/null

Note the asterisk (*) after the %f.  This is used by the awk command
as a field delimiter later on in the script.  I used * because it
could not be part of a file name so perfect for this scenario.

Repeat the above for other folders (changing the /etc to the
appropriate path, and the file name etc_files.txt to appropriate
name).

Take that thumb drive over to your messed up system and run the
following script from the thumb drive where the text files are located
(makes it easier).  Save the script as changeperms.sh.  Run it as:
./changeperms.sh etc_files.txt
Repeat for each of the files you created.

#!/bin/bash
for i in $(cat %1)
do
   tpermissions=`echo $i | awk -F* '{print $2}'`
   tfile=`echo $i | awk -F* '{print $1}'`
   echo "Changing file permissions on $tfile to $tpermissions"
   chmod $tpermissions $tfile && echo "changed..." || echo "did not change!!!"
   echo "-----------------------------------------------------------------------------------------"
done


Jacques B.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux