-
-
Save thattommyhall/8a8140edc7a0e8b9115e7a4af6c28d25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkpasswd -m sha-512 poop dd3s05pu | |
$6$dd3s05pu$hBxcrWHy1tKBDrrDZPYlnWS81JJNlimgGxukyUgNgbf6fopwFDQIvAKVYu6XXALPISmbxCWRY4hL6xjCaF7IG/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < Struct.new(:username, :password, :uid, :gid) | |
def hashed_password() | |
password.crypt("$6$" + salt) | |
end | |
def salt | |
@salt || rand(36**8).to_s(36) | |
end | |
def salt=(s) | |
@salt = s | |
end | |
def passwd_line | |
[username, | |
hashed_password, | |
uid, | |
gid, | |
gecos, | |
homedir, | |
shell | |
].join(':') | |
end | |
def homedir | |
"#{ftp_root}/#{username}" | |
end | |
def shell | |
end | |
def ftp_root | |
'/mnt/ftp' | |
end | |
def gecos | |
nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment