LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2004, 05:25 AM   #1
leecming
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Rep: Reputation: 0
Deleting a user


Hi,

I created another user for my system to let a friend try connecting to my system by ssh.
It worked but now, I can't seem to remove the user...

Even after rebooting, shutting down, the command "users" shows my friend to be logged in. What gives? How do I get rid of the user?
 
Old 06-12-2004, 06:10 AM   #2
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
I'm not an expert at any of this but, you could use the "userdel" command to remove the friends account. I have no idea why it shows that he is still logged in. But anyway, suppose your friends user name is "friend1" or something like that. You could type this:

userdel -r friend1

I believe the "-r" will cause the files in the user's home directory will be removed along with the home directory itself and the user's mail spool. You can look up more about the "userdel" command by typing this:

man userdel

It sounds like you know how to tell if some one is logged in. One way to tell if someone is currently logged in is to type this:

w

To see the last 10 log-ins you could type this:

last -10
 
Old 06-12-2004, 06:17 AM   #3
leecming
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Erm... the command "users" shows my friend to be logged in but "w" shows only roots and myself...
I can't use userdel because i'm prompted with error stating that the user is still logged in.
 
Old 06-12-2004, 06:18 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
try (as root) in a terminal

userdel <username>

where <username> is the login-username of the user you want to remove. if you have created a home directory, for example, too and want to remove it and all the files in it also when you remove the user, use

userdel -r <username>

instead. the -r switch means "remove user files too"...for more details, check

man userdel
 
Old 06-12-2004, 06:22 AM   #5
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
if you don't get rid of the login, try starting your machine in a single-user mode (runlevel 1); for example, in a terminal try

init 1

or then change your /etc/inittab settings to boot into runlevel 1..(default runlevel). this should prevent other logins...
 
Old 06-12-2004, 06:37 AM   #6
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
Another way to approach this problem is to use the "kill" command. If you can not log him out you may need to find his process ID number and use the "kill" command to kill the process. To find his process ID number you can use the "top" command and look for a proccess ID next to his name. You could type this:

top

Suppose that you find that his process ID number is 1792 or something like that (it will actually be a different number on your system). Then type this:

kill 1792

You might also want to look those commands up using the "man" command.
 
Old 06-12-2004, 07:49 AM   #7
leecming
LQ Newbie
 
Registered: Jun 2004
Posts: 12

Original Poster
Rep: Reputation: 0
Nope, still no luck...
Running init 1 shows him still logged in. No processes listed under "top".
 
Old 06-12-2004, 02:06 PM   #8
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
On my computer there are always dozens of processes listed under "top". There are always some processes running. Some of the processes are controlled by me and some by root. If the top command did not work you could look at all processes with this command instead:

ps -A

I may have possibly been wrong when I suggested that you could use the "kill" command to log him out. B0uncer's suggestion to change the runlevel might be better. Perhaps using the "init" command did not work properly for some reason. You might need to manually edit the inittab file to change the run level. The inittab file is located in the /etc directory. I am not sure which distro you are using or which text editor you use. But, suppose you use "gedit", when you are logged in as root you could type this to edit the file:

gedit /etc/inittab

Once the file is open you should see two lines that looks something like this:

# Default runlevel. (Do not set to 0 or 6)
id:3:initdefault:

The line with the "#" sign in front is just a comment. On the next line you need to change the 3 to a 1. You can then save the change and reboot. You should then be in single user mode. That sould do the same thing as what the "init 1" command should have done.

Was ssh already running by default when you installed Linux? Do you actually have any reason to have that running? For now at least you might want to shut down the sshd daemon that ssh uses. With most versions of Linux (but not Slackware) you could temporarily shut the sshd daemon down with this command:

/etc/rc.d/init.d/sshd stop

That will only temporarily stop the sshd daemon and prevent using ssh and sftp for now. It will not keep it from automatically starting up when you reboot.
 
Old 06-12-2004, 02:17 PM   #9
Rick485
Member
 
Registered: Sep 2003
Location: Arizona
Distribution: Kubuntu 8.04
Posts: 202

Rep: Reputation: 30
You might also want to see what processes (if any) that the user is using. Suppose his username is "jimbo", then you could use this command to see what processes jimbo is using:

ps -u jimbo

If you can not delete his account for some reason then you should probably at least use the "passwd" command to change his password. If his name was jimbo you could type this:

passwd jimbo
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a User carlosinfl Linux - General 2 11-10-2005 01:33 PM
deleting LDAP user...password? blink_00 SUSE / openSUSE 3 02-21-2005 11:24 AM
deleting a user joe k Linux - General 3 12-08-2004 06:31 AM
Deleting a user? WorldBuilder Linux - Software 1 03-28-2003 11:58 AM
removing/deleting a user cuss Linux - General 7 02-27-2003 02:27 PM


All times are GMT -5. The time now is 08:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration