Koozali.org: home of the SME Server

Obsolete Releases => SME Server 9.x => Topic started by: fpausp on August 04, 2016, 08:48:16 PM

Title: Temporarily lock a user account ???
Post by: fpausp on August 04, 2016, 08:48:16 PM
I would like to temp. lock a user account (over night) via console/cronjob, is there a command ?
Title: Re: Temporarily lock a user account ???
Post by: Stefano on August 04, 2016, 09:01:53 PM
please, explain your problem/aim, not your solution, thank you ;-)
Title: Re: Temporarily lock a user account ???
Post by: fpausp on August 04, 2016, 09:21:24 PM
I would like to connect via ssh and lock a user account ?
Title: Re: Temporarily lock a user account ???
Post by: Stefano on August 04, 2016, 09:28:53 PM
each time you lock an user you have to reset his password..

so, again, why you need to lock an user?

is it an X Y problem (http://xyproblem.info/) case?
Title: Re: Temporarily lock a user account ???
Post by: byte on August 05, 2016, 04:28:00 PM
I would like to temp. lock a user account (over night) via console/cronjob, is there a command ?

You can do this by using

Code: [Select]
signal-event user-lock <username>

but you will have to reset password to active the account again.
Title: Re: Temporarily lock a user account ???
Post by: fpausp on August 05, 2016, 05:36:12 PM
Yes, thank you...

# lock a user
Code: [Select]
signal-event user-lock <username>


Maybe there is a way to unlock a user, please try it out and confirm:

# unlock a user
Code: [Select]
usermod <username> -U
# correct user-unlock in server-manager
Code: [Select]
db accounts setprop <username> PasswordSet yes
Title: Re: Temporarily lock a user account ???
Post by: fpausp on August 05, 2016, 06:36:06 PM
I am sorry but my last post is not the clean solution what I am looking for...

What I like to do is lock / unlock a user account for my working RADIUS Authentication (WPA2-Enterprise WIFI).

I can do it with the server-manager but it would also be nice to do it over ssh to have the ability of automating.

 

Title: Re: Temporarily lock a user account ???
Post by: janet on August 05, 2016, 10:58:57 PM
fpausp

[quote!]I can do it with the server-manager but it would also be nice to do it over ssh to have the ability of automating.
[/quote]

Anything you can do in server manager, you can do at the command prompt eg when running a ssh session.
Anything you do at command line can be automated using a cron job. To temporarily change settings for a user you can run one cron job to disable something (say at 5pm) & then another cron job to enable something (say at 8am).

So please tell us what change you make in server manager & we will tell you what command to issue at command line/using ssh.

You can find out yourself what commands are issued when using server manager. 
Perform the required change in server manager noting the exact time you start doing this. Then when done, review the messages log file, in server manager view log files panel, select messages (which is the default) ie this is the /var/log/messages log file.

Look through the file for the exact time you made the change(s) in server manager & you will see the command or commands that the system issued.

You can also see the commands in real time by opening a putty/ssh session & running the tail command before you make the changes in server manager, & then watch the ssh session screen.
man tail
for more info.

Also FYI you can run server manager in text mode (non GUI) when using a putty/ssh session,
Type
console
& select server manager
or use elinks