Tuesday, July 21, 2015

Samba Migration to a New Server

#OLD SERVER
 mkdir /root/move


# Stop samba services
 service smb stop
 service nmb stop
 ckconfig smb off
 chkconfig nmb off

# RHEL/CentOS/Fedora: Default is 500 and upper limit is 65534 (/etc/libuser.conf).
# Debian/Ubuntu: Default is 1000 and upper limit is 29999 (/etc/adduser.conf).
 export UGIDLIMIT=500
 awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move/passwd.mig
 awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/move/group.mig
 awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig

SERVER=IPADDRESS-HERE
 rsync -av /home/ $SERVER:/home/ --delete
 rsync -av /root/move $SERVER:/root/
 rsync -av /root/bin $SERVER:/root/ --delete
 rsync -av /etc/samba $SERVER:/etc/ --delete
 rsync -av /var/lib/samba $SERVER:/var/lib/ --delete

#NEW SERVER
 cd /root/move
 cat passwd.mig >> /etc/passwd
 cat group.mig >> /etc/group
 cat shadow.mig >> /etc/shadow

#IF smbpasswd convert to tdbsam

 pdbedit -i smbpasswd -e tdbsam

mv  /etc/samba/passdb.tdb /var/lib/samba/private
mv /etc/samba/secrets.tdb /var/lib/samba/private

#Start Samba services
 service smb start
 service nmb start
 chkconfig smb on
 chkconfig nmb on

Ref:

http://amar-linux.blogspot.com/2012/03/migrating-samba-server-and-users-in.html
http://www.cyberciti.biz/faq/howto-move-migrate-user-accounts-old-to-new-server/

Thursday, June 18, 2015

Fedora 22, error with Nvidia propietary drivers and clutter

Temporary solution to error opening cheese, gnome maps, and others.

ADD:

     export CLUTTER_BACKEND=x11

to /etc/environment and restart.

References:
https://bbs.archlinux.org/viewtopic.php?id=196029

Tuesday, May 26, 2015

How to make GRE tunnel iptables port redirect on Linux

1. Load the ip_nat_pptp and ip_conntrack_pptp kernel module
modprobe ip_nat_pptp
modprobe ip_conntrack_pptp

vi /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_nat_pptp"

http://www.pc-freak.net/blog/how-to-make-gre-tunnel-iptables-port-redirect-on-linux/
http://download.parallels.com/doc/pcs/html/Parallels_Cloud_Server_Users_Guide/30254.htm

Friday, May 15, 2015

Updating XAMPP for Linux


/opt/lampp/lampp stop

mv /opt/lampp /opt/lampp.old

./xampp-linux-5.5.19-0-installer.run --mode text

/opt/lampp/lampp stop

rsync -av /opt/lampp.old/cgi-bin /opt/lampp/ --delete
rsync -av /opt/lampp.old/htdocs /opt/lampp/ --delete
rsync -av /opt/lampp.old/var/mysql /opt/lampp/var/ --delete

rsync -av /opt/lampp.old/phpmyadmin/config.inc.php /opt/lampp/phpmyadmin/
rsync -av /opt/lampp.old/etc/freetds.conf /opt/lampp/etc/freetds.conf
rsync -av /opt/lampp.old/etc/httpd.conf /opt/lampp/etc/httpd.conf
rsync -av /opt/lampp.old/etc/php.ini /opt/lampp/etc/php.ini
rsync -av /opt/lampp.old/etc/extra/httpd-ssl.conf /opt/lampp/etc/extra/httpd-ssl.conf
rsync -av /opt/lampp.old/etc/extra/httpd-userdir.conf /opt/lampp/etc/extra/httpd-userdir.conf
rsync -av /opt/lampp.old/etc/extra/httpd-vhosts.conf /opt/lampp/etc/extra/httpd-vhosts.conf
rsync -av /opt/lampp.old/etc/extra/httpd-xampp.conf /opt/lampp/etc/extra/httpd-xampp.conf
rsync -av /opt/lampp.old/etc/my.cnf /opt/lampp/etc/my.cnf

mv /opt/lampp.old/moodledata /opt/lampp/

/opt/lampp/lampp start

/opt/lampp/lampp security

rm -rf /opt/lampp.old

Cloning Disk with Acronis


After Disk Cloning using Acronis True Image partition the UUID on Grub menu and fstab are different from the original.

We need to enter in rescue mode and mount the partitions (/dev/sda5 = / & /dev/sda1 = /boot in my case).

# Mount root partition:
mount /dev/sda5 /mnt  # /dev/sda5 is your root partition, e.g. /dev/sda1

# If you have a separate boot partition you'll need to mount it also:
mount /dev/sda1 /mnt/boot

# Mount your virtual filesystems:
for i in /dev /dev/pts /proc /sys /run; do mount -B $i /mnt$i; done

# Chroot:
chroot /mnt

Change the UUID on /etc/fstab
blkid /dev/sda5 >> /etc/fstab
blkid /dev/sda1 >> /etc/fstab
use an editor like vim and replace the old UUID by the new ones

Update Grub menu if is neccesary
#Reinstall Grub menu:
grub2-install /dev/sda
 or on 1 sector of partition
grub2-install /dev/sda1


#Delete FlexNet message if you want
dd if=/dev/zero of=/dev/sda bs=512 count=62 seek=1


#:

cd /boot
dracut -f
grub2-mkconfig -o /boot/grub2/grub.cfg
exit
reboot

Monday, March 16, 2015

No Sound on linux Fedora.

Force with:
     yum install -y kernel
reboot and check again
     aplay -l

Monday, January 19, 2015

Enable java plugin on Fedora with icedtea

This is one of those “dead easy so why so hard” issues.

I use Fedora on my home desktop.


Here’s how to enable the java plugin under Fedora using icedtea (openjdk).

sudo yum install icedtea-web
sudo mkdir -p /usr/lib64/firefox/plugins
sudo ln -s /usr/lib64/IcedTeaPlugin.so /usr/lib64/firefox/plugins/libjavaplugin.so


Now restart and go here to test the java plugin now works.

References:
http://blog.yo61.com/enable-chrome-java-plugin-on-fedora-18-with-icedtea