Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Question in Linux home directory

Posted on 2013-06-17
9
509 Views
Last Modified: 2013-06-20
I need to perform this tasks on 10 Servers


remove the account of user A ( h95922) .

DO NOT REMOVE THE HOME DIRECTORY
Move the home directory for h95922 to the home directory of User_B , and make User_B  of the files.  Also, do a find from the / directory of the systems
and search for any files owned by h95922 and change the ownership to User_B .  


the commands i am thinking to use are :



# userdel h95922
# mv /home/h95922 /home/User_B
# cd /home/user_B/h95922
# chown -R user_B /home/h95922


is this correct so far ?




Also, do a find from the / directory of the systems
and search for any files owned by h95922 and change the ownership to User_B .  

( any help on this would be appreciated)
0
Comment
Question by:c_hockland
9 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
ID: 39253725
Yes.

find / -user h95922 -exec chown User_B {} \;
0
 
LVL 44

Expert Comment

by:Darr247
ID: 39253816
This sounds like a homework. Is it?
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39253870
@c_hockland - Answer of farzanj is correct but: you could have tested all the commands you listed on a testuser / testdirectory yourself so why the question?
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 34

Expert Comment

by:Seth Simmons
ID: 39253904
the fourth line is incorrect because the second line you have User_b for destination folder so that command wouldn't work.  it would be chown -R user_b /home/user_b/h95922

farzanj's find command wouldn't work since you are specifying the user though your first command you are removing the user account; you would instead specify -uid <uid> since the user doesn't exist and the files would only show uid/gid (or group) in a directory listing (example - if h95922 uid is 600, use find / -uid 600 and your other parameters/expressions)
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39253931
>> the fourth line is incorrect
No, it is correct, the h95922 folder is moved to a subfolder of user_B and the chown is recursive so subfolder h95922 has owner user_B after the chown command.
0
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 39254002
i understand it's recursive

read what you just wrote...the h95922 folder is moved to a subfolder of user_B, I understand that.  now look at specified path in that command - /home/h95922

with h95922 being moved under user_b then h95922 wouldn't be directly under /home, now would it?  the path would be /home/user_b/h95922 so the correct 4th command would be chown -R /home/user_b which would, of course, trickle down through the h95922 folder within; or just chown -R /home/user_b/h95922 for just that folder that was moved
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39254139
Yup, the path is wrong ;)

Still: OP could have tested all this before asking the question...
0
 

Author Comment

by:c_hockland
ID: 39264655
these are production servers .
Unfortunately i cannot create test users and test these commands.
0
 
LVL 29

Expert Comment

by:serialband
ID: 39264791
You could use virtualbox or xen to make test servers.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question