Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have read this these generic instructions to log users out, but I want more detail.

When I run the command users I see multiple instances of the same user. IE: Joe Joe Joe Joe Joe

How do I know if Joe is active? How would I find more information about what Joe is doing in each session? (like can I close a session Joe has open, and not loose his work?)

I am familiar with the w command. Say this user left his terminal on at home, then came into work; but rebooting the server isn't a good idea, I just used the command

pkill -KILL -u Joe bash 

This threw me out of the shell and out of the open-shell from home, with no idea if I'm loosing work in this process.

What can be done to help me evaluate which sessions can be closed safely?

I tried

skill -KILL -v /dev/pts/1 

to kill a specific session, but nothing happened.

share|improve this question
    
I also tried unmounting /dev/pts1 but the session remained mounted –  j0h Jul 13 '13 at 16:34
    
Why do you need to kill with signal 9 (SIGKILL)? This should really only be used as the last resort! Processes won't get any time from the kernel to cleanly shut down and data loss is imminent! –  gertvdijk Jul 15 '13 at 22:05

1 Answer 1

I must have misread a portion of your post.

There is not a good way of reconnecting to terminal session that you have lost connection to unless you are using screen or something similar. Here is a stackexchange post on launching screen on ssh connections:

http://unix.stackexchange.com/questions/48002/problems-with-automatically-starting-screen-on-ssh-login

Edit:

This is not a solution to this problem

kill -9 $(ps aux | grep "[ ]$(who | grep 'Joe' | awk '{print $2}')" | awk '{print $2}')

share|improve this answer
    
Could you explain what it does exactly? –  gertvdijk Jul 15 '13 at 22:05
    
Sorry, I misread your post. Updated my response –  shtuff.it Jul 15 '13 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.