Tikejhya: Ashish Nepal

Knowledgebase

Category: Package Management

How to repair/restore lost permision, file ownership

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

How to repair/restore lost permision, file ownership

Its always possible to run into trouble by chown(ing) or chmod(ing) / or /usr /home
or simillar crucial files and binary, Where below given tips can help you out.

# Restore chowned files/binary to default

rpm --setugids  

(e.g. rpm –setugids mysql, This will help you recover)

#Restore chmod’ed files/binary to defaults

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

rpm --setugids 

#To reset permision of all package

rpm --setperms -a
rpm --setugids -a

# Clone / Restore Permission from Different Server
# Retrive permision from server1

find / /usr /home -xdev | xargs getfacl -P > /tmp/permissions

#repair in server2
# Copy file across and restore permision

setfacl --restore=/tmp/permissions

PPTP VPN on CentOS

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

PPTP (Point-to-Point Tunneling Protocol)

#wget http://www.rockia.com/dl/pptpd.sh

Then hit “Enter”, the shell files should be downloaded on your server and now you can run it:

#sh pptpd.sh

#vi etc/ppp/chap-secrets

#

/etc/init.d/pptpd restart or service pptpd restart

 

Note: .sh files content:

yum remove -y pptpd
ppp
iptables –flush POSTROUTING –table nat
iptables –flush FORWARD
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp

wget
http://www.diahosting.com/dload/dkms-2.0.17.5-1.noarch.rpm
wget http://www.diahosting.com/dload/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
wget http://www.diahosting.com/dload/pptpd-1.3.4-1.rhel5.1.i386.rpm
wget http://www.diahosting.com/dload/ppp-2.4.4-9.0.rhel5.i386.rpm

yum -y install make libpcap iptables gcc- c++ logrotate tar cpio perl pam tcp_wrappers

rpm -ivh dkms-2.0.17.5-1.noarch.rpm
rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
rpm -qa kernel_ppp_mppe
rpm -Uvh ppp-2.4.4-9.0.rhel5.i386.rpm
rpm -ivh pptpd-1.3.4-1.rhel5.1.i386.rpm

mknod /dev/ppp c 108 0
echo 1 > /proc/sys/net/ipv4/ip_forward

echo “mknod /dev/ppp c 108 0″ >> /etc/rc.local
echo”
echo 1 > /proc/sys/net/ipv4/ip_forward” >> /etc/rc.local
echo “localip 172.16.36.1” >> /etc/pptpd.conf
echo “remoteip 172.16.36.2-254” >> /etc/pptpd.conf
echo “ms-dns 8.8.8.8” >> /etc/ppp/options.pptpd
echo “ms-dns 8.8.4.4” >> /etc/ppp/options.pptpd

pass=`openssl rand 6 -base64`
if [ “$1” != “” ]
then pass=$1
fi
echo “vpn pptpd ${pass} *” >> /etc/ppp/chap-secrets

iptables -t nat -A POSTROUTING -s 172.16.36.0/24 -j SNAT –to-source `ifconfig  | grep ‘inet addr:’| grep -v ‘127.0.0.1’ | cut -d: -f2 | awk ‘NR==1 { print $1}’`
iptables -A FORWARD -p tcp –syn -s 172.16.36.0/24 -j TCPMSS –set-mss 1356

service iptables save

chkconfig iptables on
chkconfig pptpd on
service iptables start
service pptpd start

echo “VPN service is installed, your VPN username is vpn, VPN password is ${pass}”

 

New Repository (Remi’s Repo)

Lets say if we want to install PHP 5.2.5 which is the latest version in the repos  you can make use of a RPM repository maintained by Remi. He has a repository for many distros.
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

(if there is no 5-3 try 5-4 no 5-4 try 5-5 ……..)

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Now you have remi’s repo in ur system. so to use the remis repo to install your packages you have to tell yum to use the new repo..

(using same context of PHP update follow below given command)
yum –enablerepo=remi update php (package)

RPM (Redhat Package Manager)

RPM “Redhat Package Manager” is open source package management system created by Redhat.

RPM DB Location: /var/lib/rpm

(Holds database files that the RPM needs in order to refer to recent Installation, updates.)

File Convention: packagename-version-release-architecture.extension (bison-2.3- 2.1 – i386-.rpm)

Read More

Powered by WordPress & Theme by Anders Norén