Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Last active December 19, 2016 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thattommyhall/8a8140edc7a0e8b9115e7a4af6c28d25 to your computer and use it in GitHub Desktop.
Save thattommyhall/8a8140edc7a0e8b9115e7a4af6c28d25 to your computer and use it in GitHub Desktop.
$ mkpasswd -m sha-512 poop dd3s05pu
$6$dd3s05pu$hBxcrWHy1tKBDrrDZPYlnWS81JJNlimgGxukyUgNgbf6fopwFDQIvAKVYu6XXALPISmbxCWRY4hL6xjCaF7IG/
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