Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get '/newfile' do
- erb :newfile
- end
- file = File.open("/home/roshan/Projects/MuttAssignment/Change3/template", "rb")
- muttconf_template = file.read
- configure = ERB.new(muttconf_template)
- post '/newfile' do
- @usrname = params[:usrname]
- @paswd = params[:paswd]
- output = configure.result(binding)
- user = @usrname
- passwd = @paswd
- # password = crypt(passwd);
- system("sudo useradd #{user} -p #{passwd.crypt("$1$password")}");
- Dir.mkdir("/home/#{user}");
- # File.chmod(0777,"/home/#{user}/.muttrc")
- File.open("/home/#{user}/.muttrc","w") do |f|
- f.write output
- f.close
- end
- "<html>
- <title>
- Success!!!
- </title>
- <head>
- <body>
- <h1>Successfully Configured Mutt!!!</h1>
- Open Terminal<br/>
- Type ssh [username]@[ip_address](ENTER)<br/>
- Type 'mutt' press enter and check you inbox
- </body>
- </head>
- </html>"
- end
- 44,0-1 Bot
Add Comment
Please, Sign In to add comment