API/User commands

From DreamHost
Jump to: navigation, search

Contents

User commands

The user API module manages shell, ftp, and vpn users (although note that the user-list_users command will also list mail users).

user-add_user

Adds a user (of type ftp, sftp, shell, or vpn). If you do not specify a password, then a password will be randomly generated and displayed in the result. Otherwise the result will just display ******** for the password. Note: billing access is required to create vpn users. A Service token will also be returned (see Service Control Commands).


Values:

type : the type of user; can be ftp, sftp, shell, or vpn
username : the desired username for the new user
gecos : the Full Name for this user, like John Smith (this field cannot be blank)
server : the home for the user (the shared server or ps).  required unless the type is vpn
shell_type : the type of shell for the user (bash, tcsh, ksh, or zsh).  only required if the type is shell
password : (optional) the password for the new user.  Will be randomly generated if not specified.
enhanced_security : (optional) set to 1 to enable Enhanced User Security (set to 0 or leave blank to disable)
billing_cycle : (optional) This only pertains to billing for vpn users and can be either monthly or yearly (defaults to monthly)

Result:

success
username	password	token
testuser123	********	gcnaBcD12eFgH34iJkL

Possible Errors:

no_type
no_username
no_gecos
no_server
no_shell_type
invalid_type
invalid_shell_type
invalid_server
invalid_username (specific error after a tab)
user_exists
invalid_gecos (specific error after a tab)
invalid_password (specific error after a tab)

user-list_users

Dump a list of all users (including ftp, shell, vpn, anonymous ftp, backup, and mailboxes) on all accounts you have access to. Passwords are no longer available via this API command.

Values:

(none)

Result:

success
account_id	username	type	shell	home	password	disk_used_mb	quota_mb	gecos
1	anftp	ftp	/etc/ftponly	machine.dreamhost.com	0	671744	An FTP user
1	b1	backup	/usr/bin/rssh	backup.dreamhost.com	0	671744	Account #1 Backup User
1	blah	shell	/bin/bash	machine.dreamhost.com	0	671744	Blah Shell
1	crazyvpn	vpn		toy.dreamhost.com	0	671744	Crazy VPN
1	josh@blah.com	mail	/etc/poponly	smaug.dreamhost.com	0	671744	Josh Email User!

Possible Values:

type : ftp or sftp or backup or shell or vpn or mail

Possible Errors:

(none)

user-remove_user

Removes a user specified by the username. Optionally the type of user or home can be specified to distinguish the user to delete (if the user exists on multiple homes/types). To specify the home, set the username to username@home. If the username has more than one type/home, you can set remove_all to remove all instances of the user (note: if remove_all is set and the type or home is specified, it will remove all instances of username with that type or on that home). Note: Removing a VPN user might add a credit to your account if you had been previously billed for VPN users.

Values:

username : the user to remove, like testuser42.  Optionally use username@home to specify a home, like testuser42@riga
type : (Optional) the type of user, like ftp, shell, etc
remove_all : (Optional) set to 1 to remove all instances of this user (if user has multiple types or is on multiple homes)

Result:

success

Possible Errors:

invalid_user (specific error after tab)
multiple_user_services (specific error after tab, such as the user has more than one type/home and the type/home and remove_all were not set)
cannot_remove_user (specific error after tab)
Personal tools