Cool. I think providing this as an options would be a good idea.


On Thu, Mar 28, 2013 at 7:06 PM, scriptjunkie <notifications@github.com>wrote:

> In modules/post/linux/manage/add_user.rb:
>
> > +					],
> > +				'Platform'      => [ 'linux' ],
> > +				'SessionTypes'  => [ 'shell' ]
> > +			))
> > +			register_options(
> > +			[
> > +				OptString.new('USER', [true, 'User to add.']),
> > +				OptString.new('PASS', [true, 'Password of the user.']),
> > +				OptBool.new('SUDO', [true, 'Give user sudo privs.',true]),
> > +			], self.class)
> > +
> > +	end
> > +
> > +	def run
> > +		if is_root?
> > +			cmd_exec_vprint("useradd #{datastore['USER']} -p #{datastore['PASS']} ")
>
> I take back the part about /etc/passwd. If we take the standards as any
> indication of portability, useradd is in the LSB, but /etc/passwd is not
> really specified (although it's mentioned) so it should be plenty portable.
> Also, sudo is not mentioned at all. But instead, you could add the options
> "-u 0 -o" to useradd to create an account that is an alias to root.
> http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/useradd.html
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/rapid7/metasploit-framework/pull/1605/files#r3580489>
> .
>