<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RedHatVN Network &#187; move account</title>
	<atom:link href="http://redhatvn.net/tag/move-account/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Mon, 31 Oct 2011 07:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Script to change IP address of all the accounts.</title>
		<link>http://redhatvn.net/script-to-change-ip-address-of-all-the-accounts</link>
		<comments>http://redhatvn.net/script-to-change-ip-address-of-all-the-accounts#comments</comments>
		<pubDate>Fri, 25 Dec 2009 05:48:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[move account]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=961</guid>
		<description><![CDATA[How to change IP address of all the accounts on a cPanel server? The “Change Site IP Address” option is WHM is not feasible in case you need to change IP address of all the accounts on a server. In order to change IP address of all the domains on a cPanel server, you have [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/script-to-change-ip-address-of-all-the-accounts"></g:plusone></div><p><span style="color: #ff0000;"><strong>How to change IP address of all the accounts on a cPanel server?</strong></span><br />
The <strong>“Change Site IP Address” option is WHM is not feasible</strong> in case you need to change IP address of all the accounts on a server. In order to change IP address of all the domains on a cPanel server, you have to <strong>use the “swapip” script provided by cPanel.</strong><br />
<span id="more-961"></span><br />
The following script will do the needful:</p>
<blockquote><p><strong>for i in `cat /etc/trueuserdomains | cut -d: -f1`<br />
do<br />
/usr/local/cpanel/bin/swapip OLDIP NEWIP $i;<br />
done;</strong></p></blockquote>
<p><strong>where,</strong></p>
<blockquote><p><strong>OLDIP is the current IP assigned to the domain.<br />
NEWIP is the new IP which you would like to assign.<br />
$i is the domain names read per line from the /etc/trueuserdomains file.</strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/script-to-change-ip-address-of-all-the-accounts/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Move or migrate user accounts from old Linux server to a new Linux server</title>
		<link>http://redhatvn.net/move-or-migrate-user-accounts-from-old-linux-server-to-a-new-linux-server</link>
		<comments>http://redhatvn.net/move-or-migrate-user-accounts-from-old-linux-server-to-a-new-linux-server#comments</comments>
		<pubDate>Thu, 27 Aug 2009 09:36:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[move account]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=273</guid>
		<description><![CDATA[Q. How do I Move or migrate user accounts to from old Linux server a new Cent OS Linux server including mails? This new system a fresh installation. A. You can migrate users from old Linux server to new Linux sever with standard commands such as tar, awk, scp and others. This is also useful [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/move-or-migrate-user-accounts-from-old-linux-server-to-a-new-linux-server"></g:plusone></div><p><span style="color: #ff0000;">Q</span>. How do I Move or migrate user accounts to from old Linux server a new Cent OS Linux server including mails? This new system a fresh installation.</p>
<p><span style="color: #009900;">A.</span> You can migrate users from old Linux server to new Linux sever with standard commands such as tar, awk, scp and others. This is also useful if you are using old Linux distribution such as Redhat 9 or Debian 2.x.</p>
<p><span id="more-273"></span></p>
<p>Following files/dirs are required for traditional Linux user management:<br />
* <strong><a href="http://www.cyberciti.biz/faq/understanding-etcpasswd-file-format/">/etc/passwd</a></strong> &#8211; contains various pieces of information for each user account</p>
<p>* <strong><a href="http://www.cyberciti.biz/faq/understanding-etcshadow-file/">/etc/shadow</a></strong> &#8211; contains  the encrypted password information for user&#8217;s accounts and optional the password aging information.</p>
<p>* <strong><a href="http://www.cyberciti.biz/faq/understanding-etcgroup-file/">/etc/group</a></strong> &#8211; defines the groups to which users belong</p>
<p>* <strong>/etc/gshadow</strong> &#8211; group shadow file (contains the encrypted password for group)</p>
<p>* <strong>/var/spool/mail</strong> &#8211;  Generally user emails are stored here.</p>
<p>* <strong>/home</strong> &#8211;  All Users  data is stored here.</p>
<p>You need to backup all of the above files and directories from old server to new Linux server.</p>
<h3>Commands to type on old Linux system</h3>
<p>First create a tar ball of old uses (old Linux system). Create a directory:<br />
<code># mkdir /root/move/</code><br />
Setup UID filter limit:<br />
<code># export UGIDLIMIT=500</code><br />
Now copy /etc/passwd accounts to /root/move/passwd.mig using awk to filter out system account (i.e. only copy user accounts)<br />
<code># awk -v LIMIT=$UGIDLIMIT -F: '($3&gt;=LIMIT) &amp;&amp; ($3!=65534)' /etc/passwd &gt; /root/move/passwd.mig</code><br />
Copy /etc/group file:<br />
<code># awk -v LIMIT=$UGIDLIMIT -F: '($3&gt;=LIMIT) &amp;&amp; ($3!=65534)' /etc/group &gt; /root/move/group.mig</code><br />
Copy /etc/shadow file:<br />
<code># awk -v LIMIT=$UGIDLIMIT -F: '($3&gt;=LIMIT) &amp;&amp; ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow &gt; /root/move/shadow.mig</code><br />
Copy /etc/gshadow (rarely used):<br />
<code># cp /etc/gshadow /root/move/gshadow.mig</code><br />
Make a backup of /home and /var/spool/mail dirs:<br />
<code># tar -zcvpf /root/move/home.tar.gz /home<br />
# tar -zcvpf /root/move/mail.tar.gz /var/spool/mail</code></p>
<p>Where,</p>
<ul>
<li>Users that are added to the Linux system always start with UID and GID values of as specified by Linux distribution or set by admin. Limits according to different Linux distro:
<ul>
<li><strong>RHEL/CentOS/Fedora Core</strong> : Default is 500 and upper limit is 65534 (/etc/libuser.conf).</li>
<li><strong>Debian and Ubuntu Linux</strong> : Default is 1000 and upper limit is 29999 (/etc/adduser.conf).</li>
</ul>
</li>
<li>You should never ever create any new system user accounts on the newly installed Cent OS Linux. So above awk command filter out UID according to Linux distro.</li>
<li><strong>export UGIDLIMIT=500 </strong> &#8211; setup UID start limit for normal user account. Set this value as per your Linux distro.</li>
<li><strong>awk -v LIMIT=$UGIDLIMIT -F: &#8216;($3&gt;=LIMIT) &amp;&amp; ($3!=65534)&#8217; /etc/passwd &gt; /root/move/passwd.mig</strong> &#8211; You need to pass UGIDLIMIT variable to awk using -v option (it assigns value of shell variable UGIDLIMIT to awk program variable LIMIT). Option -F: sets the field separator to : . Finally awk read each line from /etc/passwd, filter out system accounts and generates new file /root/move/passwd.mig. Same logic is applies to rest of awk command.</li>
<li><strong>tar -zcvpf /root/move/home.tar.gz /home</strong> &#8211; Make a backup of users /home dir</li>
<li><strong>tar -zcvpf /root/move/mail.tar.gz /var/spool/mail</strong> &#8211; Make a backup of users mail dir</li>
</ul>
<p>Use scp or usb pen or tape to copy /root/move to a new Linux system.<br />
<code># scp -r /root/move/* user@new.linuxserver.com:/path/to/location</code></p>
<h3>Commands to type on new Linux system</h3>
<p>First, make a backup of current users and passwords:<br />
<code># mkdir /root/newsusers.bak<br />
# cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak<br />
</code><br />
Now restore passwd and other files in /etc/<br />
<code># cd /path/to/location<br />
# cat passwd.mig &gt;&gt; /etc/passwd<br />
# cat group.mig &gt;&gt; /etc/group<br />
# cat shadow.mig &gt;&gt; /etc/shadow<br />
# /bin/cp gshadow.mig /etc/gshadow</code></p>
<p>Please note that you must use <strong>&gt;&gt;</strong> (append)  and not <strong>&gt;</strong> (create) shell redirection.</p>
<p>Now copy and extract home.tar.gz to new server /home<br />
<code># cd /<br />
# tar -zxvf /path/to/location/home.tar.gz</code></p>
<p>Now copy and extract mail.tar.gz (Mails) to new server /var/spool/mail<br />
<code># cd /<br />
# tar -zxvf /path/to/location/mail.tar.gz</code></p>
<p>Now reboot system; when the Linux comes back,  your user accounts will work as they did before on old system:<br />
<code># reboot</code></p>
<p>Please note that if you are new to Linux perform above commands in a sandbox environment. Above technique can be used to UNIX to UNIX OR UNIX to Linux account migration. You need to make couple of changes but overall the concept remains the same.</p>
<h3>Further readings</h3>
<ul>
<li>Read man pages of awk, passwd(5), shadow(5), group(5), tar command</li>
</ul>
<p>Updated for accuracy.</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/move-or-migrate-user-accounts-from-old-linux-server-to-a-new-linux-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
