This might sound like a silly idea, but if the users aren’t actually doing anything, you could do:
cat /etc/passwd | cut -f 1 -d : >/tmp/users.list
Then edit /tmp/users.list to only contain the users you want. Then do:
for i in `cat /tmp/users.list`
do
userdel $i
useradd -m $i
done
However, many Redhat based distributions will create you a new home directory when you first login, providing it is specified in /etc/passwd where the directory should be.
To test that, do an “su – ” and see if it does “the right thing”. If it doesn’t, the above script will work quite nicely, I think.
Related Posts:
- How can I rename a Unix user?
- How do I deal with a filename that starts with the hyphen (-) character?
- Bash: No such file or directory?
- What’s a .sh file?
- How to get the url of the current svn repo?
- How to unmount a busy device
- How to unmount a busy device
- performing HTTP requests with cURL (using PROXY)
- No space left on device
- Amazon Linux: apt-get: command not found
- Pass a password to ssh in pure bash
- How can I exclude directories from grep -R?
- gcc: error: unrecognized command line option
- How to set proxy for wget?
- Docker can’t connect to docker daemon
- Need a good hex editor for Linux
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Directory Inode vs Regular File Inode
- How to cat <
> a file containing code? - Diff command along with Grep gives “Binary file (standard input) matches”
- can’t remove python pip
- How would I get a cron job to run every 30 minutes?
- How to automatically redirect HTTP to HTTPS on Apache servers?
- Trying to use bash on Windows and got no installed distributions message
- “Unable to find remote helper for ‘https'” during git clone
- Is there a “goto” statement in bash?
- tar: Cowardly refusing to create an empty archive
- How can I delete a user in linux when the system says its currently used in a process
- Command to change the default home directory of a user
- Post request with Wget?
- Telnet [Unable to connect to remote host: Connection refused]
- Terminal Multiplexer for Microsoft Windows – Installers for GNU Screen or tmux
- Can’t remove a directory in Unix
- Is there an alternative sleep function in C to milliseconds?
- Gedit command not working in kali linux terminal
- Syntax error near unexpected token ‘then’
- Curl : connection refused
- How to install Android SDK on Ubuntu?
- C fopen vs open
- How can I use grep to show just filenames on Linux?
- Bash script prints “Command Not Found” on empty lines
- Bash export command
- How to edit gitignore file
- Retrieve last 100 lines logs
- What are various options / arguments for “./configure” in Linux
- Adding a new entry to the PATH variable in ZSH
- CronJob not running
- How to configure WP filesystem access in Linux (Ubuntu Server)?
- Can’t upload media to my Raspberry Pi WordPress server
- Can scp copy directories recursively?
- Copying a large directory tree locally? cp or rsync?
- What are the functional differences between .profile .bash_profile and .bashrc
- Check if port is open or closed on a Linux server?
- Why does my hostname appear with the address 127.0.1.1 rather than 127.0.0.1 in /etc/hosts?
- Linux command to inspect TXT records of a domain [closed]
- When does `cron.daily` run?
- How to run a command multiple times, using bash shell?
- How to reconnect to a disconnected ssh session
- What does a + mean at the end of the permissions from ls -l?
- Should I quit using Ifconfig?
- SSL Certificate Location on UNIX/Linux
- What is “-bash: !”: event not found”
- What version of RHEL am I using?
- Keeping a linux process running after I logout
- Force dig to resolve without using cache
- How do you make it obvious you are on a production system?
- How can I verify if TLS 1.2 is supported on a remote web server from the RHEL/CentOS shell?
- How to forcibly close a socket in TIME_WAIT?
- How to check if an RSA public / private key pair match
- Mount CIFS Host is down
- Colors in bash after piping through less?
- List of files installed from apt package
- How to copy a large number of files quickly between two servers
- Why does sudo command take long to execute?
- Allow SFTP but disallow SSH?
- “POSSIBLE BREAK-IN ATTEMPT!” in /var/log/secure — what does this mean?
- How to display certain lines from a text file in Linux?
- Can you have more than one ~/.ssh/config file?
- How can I export the privileges from MySQL and then import to a new server?
- Is there a directory equivalent of /dev/null in Linux?
- How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass?
- Can I send some text to the STDIN of an active process running in a screen session?
- How can I get processor/RAM/disk specs from the Linux command Line? [duplicate]
- GPG does not have enough entropy
- Is there a way to see the execution tree of systemd?
- Why don’t EC2 ubuntu images have swap?
- How to determine the hostname from an IP address in a Windows network?
- SSHFS mount that survives disconnect
- Temporarily ignore my `~/.ssh/known_hosts` file?
- How to get TX/RX bytes without ifconfig?
- How can I fully log all bash scripts actions?
- How do I redirect subdomains to a different port on the same server?
- Running Cron every 2 hours [duplicate]
- How to check the physical status of an ethernet port in Linux?
- What does “debconf: delaying package configuration, since apt-utils is not installed” mean?
- Testing UDP port connectivity
- In Linux, what is the difference between “buffers” and “cache” reported by the free command?
- memcache vs memcached?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- What is the debian-sys-maint MySQL user (and more)?