rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: Denis on November 09, 2011, 07:27:00 AM

Title: HFS print list of users
Post by: Denis on November 09, 2011, 07:27:00 AM
Is it possible to print all HFS users and their passwords, that would be great couse i'm administrating a school server, so it could be a lot easier.

Is it also possible to make random passwords for all accounts, so i could then print.

I also have folders in my file system which have the same name as the user account that belong to it, is it possible that HFS gives right to the user that have the same name as the folder.

Hope you can help :)
Title: Re: HFS print list of users
Post by: raybob on November 09, 2011, 11:44:12 AM
You could save each student's username to a text file, like this user1;user2;user3 and then run a script along the lines of this:

Code: [Select]
{.for each|username|{.replace|;|{.no pipe||.}|{.load|usernames.txt.}.}|{:
{.set|random|{.random|1|2|3|4|5|6|7|8|9.}{.random|1|2|3|4|5|6|7|8|9.}{.random|1|2|3|4|5|6|7|8|9.}{.random|1|2|3|4|5|6|7|8|9.}{.random|1|2|3|4|5|6|7|8|9.}{.random|1|2|3|4|5|6|7|8|9.}.}
{.set account|{.^username.}|password={.^random.}.}
{.append|passwordlist.txt|
{.^username.} {.^random.}
.}
:}.}

(not tested)
Title: Re: HFS print list of users
Post by: Denis on November 09, 2011, 06:24:22 PM
So what you're saying is, that when i run this script i will get a text document with all the users and passwords? And where to put or run the code?
And do you also know if i can give folder rights to the username which is the same, maybe a macro?

Thanks for the help!
Title: Re: HFS print list of users
Post by: raybob on November 09, 2011, 08:26:19 PM
If you put all the names in username.txt, it will output a TXT file with all the names and new random passwords.

Run the script by putting in a section called [test] in the template, then going to http://127.0.0.1/~test in your browser.

EDIT:

If you replace {.load|usernames.txt.} with {.get|accounts.} in the above script, it will automatically load all the account names from HFS.
Title: Re: HFS print list of users
Post by: Denis on November 10, 2011, 02:19:59 PM
Tested and work :) But, it try to give the group can change password a password :) And is this a macro? And do you know if it's possible to also make a script for the rights, i discribed above?

Thank you so much for the help :)
Title: Re: HFS print list of users
Post by: raybob on November 10, 2011, 09:06:11 PM
Assuming you have a folder for each user where its name is the title, perhaps something like

Code: [Select]
{.for each|username|{.replace|;|{.no pipe||.}|{.get|accounts.}.}|{:
{.set folder|{.^username.}|access={.^username.}|delete={.^username.}|upload={.^username.}.}
:}.}
Title: Re: HFS print list of users
Post by: Denis on November 11, 2011, 07:34:24 AM
It dosen't work,
Quote
macro error: set folder
not supported or illegal parameters
apear on the screen, is it possible, couse i have my account which dosen't have a folder and there is also a account named "can change password" which also don't have a folder.

It shows the message more than once, it's a long list with it.

What to do now?
Title: Re: HFS print list of users
Post by: raybob on November 11, 2011, 02:22:12 PM
Simple, I accidentally put the wrong macro name lol...

It's actually {.set item.}   ;)

Code: [Select]
{.for each|username|{.replace|;|{.no pipe||.}|{.get|accounts.}.}|{:
{.set item|{.^username.}|access={.^username.}|delete={.^username.}|upload={.^username.}.}
:}.}
Title: Re: HFS print list of users
Post by: rejetto on November 13, 2011, 10:52:50 PM
raybob, just a suggestion for your password generation
{.random number | 100000 | 999999 .}
Title: Re: HFS print list of users
Post by: Denis on November 14, 2011, 09:25:33 AM
And this should be pasted instead of what?

And how do i now give myself permissions to everything?
Title: Re: HFS print list of users
Post by: rejetto on November 14, 2011, 10:15:31 AM
And how do i now give myself permissions to everything?

after you run the raybob's script you can still make any change you want on the HFS window.
Still, you can even automate permissions setting if it follows a simple rule.
Title: Re: HFS print list of users
Post by: Denis on November 15, 2011, 07:05:04 AM
But how to create the rule?

I'm new in macros, so i don't know pretty much :(

And another problem, all students with danish letters (æ, ø, å) cannot login, what should i do with that?

And is it possible to make all the users be a part of the group can change password?
Title: Re: HFS print list of users
Post by: rejetto on November 15, 2011, 02:04:16 PM
first you have to express the rule in human language,
then you translate it to the scripting language

Quote
And another problem, all students with danish letters (æ, ø, å) cannot login, what should i do with that?

that requires some investigation. Sadly i don't have time these days :(
I hope someone else could help you.
Anyway, are you using the default template?
And what exact version of HFS ?

Quote
And is it possible to make all the users be a part of the group can change password?

instead of
{.set account|{.^username.}|password={.^random.}.}

use this
{.set account|{.^username.}|password={.^random.}|add member of=can change password.}

i examined this page to know what to do
http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands#Account_manipulation
Title: Re: HFS print list of users
Post by: Denis on November 15, 2011, 04:50:02 PM
I'm using the default template, and using the newest beta version of HFS which is #279 :)

Hope someone can help, couse i really do'nt know what to do! I thought about, could i make so if the user name was æøå so i instead of that put æø&åring; ?

How to i make a script that write all the user names and their passwords to a file, without randomize their passwords?

And, how do i protect the section with the password randomizer?
Title: Re: HFS print list of users
Post by: raybob on November 17, 2011, 07:40:26 PM
I don't know what to do about the names.

And, how do i protect the section with the password randomizer?

Put |private after the section, like [section|private]

How to i make a script that write all the user names and their passwords to a file, without randomize their passwords?

Code: [Select]
{.for each|username|{.replace|;|{.no pipe||.}|{.get|accounts.}.}|{:{.append|users.txt|
{.^username.} - {.get account|{.^username.}|password.}.}:}.}

Title: Re: HFS print list of users
Post by: Denis on November 17, 2011, 07:59:41 PM
Thanks, but after making a private section, how do I administrate who can "acces" it?

Thanks for the help.
Title: Re: HFS print list of users
Post by: raybob on November 17, 2011, 09:31:28 PM
Put something like this around the script:

Code: [Select]
{.if|{.=|%user%|admin.}|{:

(script here)

:}.}
Title: Re: HFS print list of users
Post by: rejetto on November 18, 2011, 03:17:09 PM
instead of putting the script in a template [section]
you can put it in the diff template of a virtual folder,
so you can control access as you normally do with folders.
Title: Re: HFS print list of users
Post by: Denis on November 24, 2011, 07:27:09 AM
With raybob's script i cannot even acces it anymore, it just say "not found" :(
Title: Re: HFS print list of users
Post by: raybob on November 24, 2011, 03:40:51 PM
When I said put it around the script, the [section header] still needs to go above it.


Code: [Select]
[section name]
{.if|{.=|%user%|admin.}|{:
(rest of script here)
:}.}