rejetto forum

HFS print list of users

Denis · 20 · 19421

0 Members and 1 Guest are viewing this topic.

Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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 :)


Offline raybob

  • Tireless poster
  • ****
    • Posts: 454
    • View Profile
    • FileSplat.com
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)


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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!


Offline raybob

  • Tireless poster
  • ****
    • Posts: 454
    • View Profile
    • FileSplat.com
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.
« Last Edit: November 10, 2011, 03:04:16 AM by raybob »


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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 :)


Offline raybob

  • Tireless poster
  • ****
    • Posts: 454
    • View Profile
    • FileSplat.com
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.}.}
:}.}
« Last Edit: November 11, 2011, 02:23:16 PM by raybob »


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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?


Offline raybob

  • Tireless poster
  • ****
    • Posts: 454
    • View Profile
    • FileSplat.com
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.}.}
:}.}
« Last Edit: November 11, 2011, 02:24:12 PM by raybob »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
raybob, just a suggestion for your password generation
{.random number | 100000 | 999999 .}


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
And this should be pasted instead of what?

And how do i now give myself permissions to everything?
« Last Edit: November 14, 2011, 09:27:58 AM by Denis »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
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.


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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?
« Last Edit: November 15, 2011, 11:24:24 AM by Denis »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
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


Offline Denis

  • Occasional poster
  • *
    • Posts: 34
    • View Profile
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?
« Last Edit: November 17, 2011, 02:18:59 PM by Denis »


Offline raybob

  • Tireless poster
  • ****
    • Posts: 454
    • View Profile
    • FileSplat.com
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.}.}:}.}

« Last Edit: November 17, 2011, 07:42:24 PM by raybob »