General discussion

  • Creator
    Topic
  • #2093173

    Removal of unwanted /home/user accounts

    Locked

    by chipwert ·

    Is there a way to remove unwanted /home/user directories from a autofs Solaris 2.5.1 system? I can deacivate them by putting an * in the passwd file but I want to remove the directories and every thing in them. I assume it unmounting in some way the/home but have read it is treated “specially”. I am pretty new at this so be gentle :}
    Thanks for all replies,
    Chip

All Comments

  • Author
    Replies
    • #3871520

      Removal of unwanted /home/user accounts

      by ramil.israfilov ·

      In reply to Removal of unwanted /home/user accounts

      you can remove users directories by removing their directories from /export/home.
      #rm -rf /export/home/username

      during startup Solaris automounter mounts /export/home to /home and you don’t have rights to remove /home/username directory directly. That’s why /export/home/username should be used.
      Ramil

    • #3871246

      Removal of unwanted /home/user accounts

      by chipwert ·

      In reply to Removal of unwanted /home/user accounts

      Sorry, I also have a slave server that has a home and home1 directory. On the master there is home home1 home2 home3. home3 is /export/home3/. I am not sure if this makes a difference but I was not able to remove them with the first answer.

    • #3868207

      Removal of unwanted /home/user accounts

      by dabutler ·

      In reply to Removal of unwanted /home/user accounts

      Chip,
      First lets figure out whether you are running nis or nisplus – you may want to look at your processes and get familiar with them – are your running something called ypserv?
      To find out, do a
      ps -ef | grep ypserv
      If you are running ypserv, then you need to figure out where the files are physically located, edit the tables and clean them out. I will assume that you are not using nisplus for now, and that you are using nis.

      First

      ypcat -k auto.home –
      This should list all of the home areas, the ypcat command – yes there is a man page – can do you no damage – it just cats stuff out….

      you will have an auto.home or auto.users – but sounds like you are an auto.home kind of person… so, to find the user you want to delete,
      ypcat -k auto.home | grep username

      this will tell you host:/path/subpath
      that is the directory that you must delete. Now you must clean up the nis tables. They are probably in etc, but could be in /var/yp…

      I would cd to /etc
      cat auto.home if it exists, and if it does, look for the line of the user you want to delete with the grep command.

      cd /etc
      grep username auto.home

      If you get a hit, and see the line for the user, just vi the file, and delete the line

      Good luck!!!

    • #3868204

      Removal of unwanted /home/user accounts

      by dabutler ·

      In reply to Removal of unwanted /home/user accounts

      Oh – I forgot, after you edit the /etc/auto.home file, you may want to rebuild the maps using /var/yp/ypmake

      An easier way to do all of this is to simply use solstice to remove the user.

    • #3866367

      Removal of unwanted /home/user accounts

      by chipwert ·

      In reply to Removal of unwanted /home/user accounts

      Thank you for all your responses I will try them all when I return to work after the holidays. Sorry for the delay.

    • #3844988

      Removal of unwanted /home/user accounts

      by jpoconnor ·

      In reply to Removal of unwanted /home/user accounts

      Assumption #1: You have root access
      Assumption #2: It is acceptable to delete the user.

      If both assumptions are correct, then the command….
      userdel -r loginname
      ….. will remove the users home directory.

      If you want to keep the usersinformation but remove their home directories, perhaps you should first change their home directory to point to /tmp and then remove the home directories.

      First get a list of the users home directories by looking in /etc/passwd. Then to change their home directories, use…..
      usermod -d /tmp loginname

      Don’t use the -m switch, this will MOVE the contents to the /tmp directory.

      Once this is complete, you can delete the home directories (you have the list from querring /etc/passwd) byusing ……
      rm -rf /home/loginname*

      Be careful here, if you have a user named joe and a user named joe2, and you want to remove joe2 but leave joe intact, that comman will clobber BOTH. A safer way that will require more typing is……
      rm -rf /home/loginname/*
      cd /home/loginname
      rm .*
      cd /home
      rmdir /home/loginname

      You will get an error message when you execute the command [rm .*] because you will not be able to rm the current or parent directory, but it will succeed in removing all the dot files (.sh_history, .profile, etc.) that are missed by ….
      rm -rf /home/loginname/*

      Good luck. I hope this works for you

    • #3856816

      Removal of unwanted /home/user accounts

      by chipwert ·

      In reply to Removal of unwanted /home/user accounts

      Hello All,
      Thanks for the time to reply. I have yet to be able to try any of the solutions due to putting out fires elsewhere. I hope to get back to it by the end of this month. Is this acceptable in relation to the point system? Sorry if I have breached any protcool. Let me know if I should do something.
      Oh by the way I am running NIS not Plus.
      Thanks again for all the time taking answering my questions.

Viewing 6 reply threads