Tip

Moving users

A network of fast, highly connected systems without "users" is a pleasant daydream for many system administrators. The reality would probably be boring, though; no need for new technologies, no amusement at the replies to the "is it plugged in" question, and no war stories about amazing technological ineptitude to tell at meetings and conferences.

Let's face it: We are stuck with users and new computers, and that means that eventually we'll have to move users' home directories to new disks or machines. You may not have had to do this yet, or you might have done it and had problems. In either case, here are the primary issues to which you must pay attention.

You either must (or should) preserve:

  • User and group ID (ownership);
  • Permissions;
  • Date and time stamps

for all objects.

The user and group owner names that show up in an "ls -l" are not stored with objects (files and directories). Only the UID and GID numbers are stored in the VTOCE block on disk. The "ls" command looks up these numbers and reports the matching names from the passwd and group databases (e.g., whatever technique you are using: files, nis, etc.).

If the users' files are moving onto a machine that uses the same databases (e.g., is within the NIS domain, on the same server, etc.), then all you must do is preserve the object's ownership.

If you're moving the user to a machine using a different password/group database, things

    Requires Free Membership to View

are more complex. In this situation, you must either create a new user and group on the new machine with the same UID/GID numbers, or change the numbers on all files to whatever you give the new account (chown -R UID:GID). What you do will probably depend on whether the user's UID is already in use on the new machine. To find a user's UID/GID, either issue the "ID" command when logged in as that user, or look the username up in the passwd database.

When adding a new user, most LINUX systems have some variety of "useradd" or "userconf," which will allow you to specify the UID and GID to be used.

When you do the actual move of the files, be sure to use the correct options to preserve permissions and date/time stamps. Most commands accept options to the "restore" part of the command for this purpose (tar has "-p," pax has "e," unzip has "-X," etc.).

Losing date and time stamps is mostly a nuisance, but losing permissions can cause both security and application problems.


Fred Mallett is founder of FAME Computer Education, which provides standup delivery of educational classes on a variety of UNIX, Linux and Win32 related subjects. Reach him at fredm@famece.com.


This was first published in November 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.