This project is read-only.

How to pass password while creating new User

Sep 16, 2011 at 1:58 PM


How can i create a new user in unix and assign a password to it using SSH.Net.

Actually i am able to create new user but unable to assign the paasword.

my code looks like this.

var objClient = new SshClient("", "root", "vikas123");



 var cmd = objClient.RunCommand("useradd -m -g TestUser ;echo \"test123\"  | passwd testuser");

 var result = cmd.Result; 



The error which i am getting is

Changing password for user TestUser.
New UNIX password: Retype new UNIX password: New UNIX password: New UNIX password: passwd: Authentication information cannot be recovered


Please help.

Thanks & regards,


Sep 19, 2011 at 1:31 PM


Could any one help me with the above problem.



Sep 23, 2011 at 5:46 PM

Sorry for late response, but I was hoping that someone else have a solution for you since I am not aware of any way to do it.

Unfortunately it seems that commands that require "sudo" in front of them are note supported by SSH when using the command object.