Koozali.org: home of the SME Server

Temporarily lock a user account ???

Offline fpausp

  • *
  • 728
  • +0/-0
Temporarily lock a user account ???
« 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 ?
Viribus unitis

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Temporarily lock a user account ???
« Reply #1 on: August 04, 2016, 09:01:53 PM »
please, explain your problem/aim, not your solution, thank you ;-)

Offline fpausp

  • *
  • 728
  • +0/-0
Re: Temporarily lock a user account ???
« Reply #2 on: August 04, 2016, 09:21:24 PM »
I would like to connect via ssh and lock a user account ?
Viribus unitis

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Temporarily lock a user account ???
« Reply #3 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 case?

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Temporarily lock a user account ???
« Reply #4 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.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline fpausp

  • *
  • 728
  • +0/-0
Re: Temporarily lock a user account ???
« Reply #5 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
Viribus unitis

Offline fpausp

  • *
  • 728
  • +0/-0
Re: Temporarily lock a user account ???
« Reply #6 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.

 

Viribus unitis

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Temporarily lock a user account ???
« Reply #7 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
« Last Edit: August 05, 2016, 11:05:44 PM by janet »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.