Skip to main content

users

Creates, updates, deletes, gets or lists a users resource.

Overview​

Nameusers
TypeResource
Idovh.hosting_web.users

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
task_idintegerThe task ID working on this user (wire: taskId)
homestringHome directory
is_primary_accountbooleanIs this user primary (wire: isPrimaryAccount)
loginstringLogin used to connect on FTP and SSH
service_management_credentialsobjectCredentials to manage your webhosting (wire: serviceManagementCredentials)
ssh_statestringUser ssh status (active, none, sftponly) (wire: sshState)
statestringUser state (off, rw)
statusstringThe user status (created, creating, deleting, updating)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectlogin, service_nameGet a user. Returns the home directory, SSH state, state and status of the user, and whether it is the primary account.
listselectservice_namehome, login, x_pagination_modeList users. Returns the logins of the FTP and SSH users of the hosting. Filter them by home or login.
createinsertservice_name, home, login, passwordCreate a user. Creates an FTP and SSH user with a login, a password and a home directory, and returns the task. sshState is none by default.
updateupdatelogin, service_nameUpdate a user. Updates the home directory, SSH state or state of the user. Set state to off to disable the FTP and SSH access of the user.
deletedeletelogin, service_nameDelete a user. Permanently deletes the user and returns the task. The files in its home folder are kept.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
loginstringLogin used to connect on FTP and SSH
service_namestringThe internal name of your hosting (wire: serviceName)
homestringFilter the value of home property (like)
loginstringFilter the value of login property (like)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a user. Returns the home directory, SSH state, state and status of the user, and whether it is the primary account.

SELECT
task_id,
home,
is_primary_account,
login,
service_management_credentials,
ssh_state,
state,
status
FROM ovh.hosting_web.users
WHERE login = '{{ login }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Create a user. Creates an FTP and SSH user with a login, a password and a home directory, and returns the task. sshState is none by default.

INSERT INTO ovh.hosting_web.users (
home,
login,
password,
ssh_state,
service_name
)
SELECT
'{{ home }}' /* required */,
'{{ login }}' /* required */,
'{{ password }}' /* required */,
'{{ ssh_state }}',
'{{ service_name }}'
RETURNING
id,
object_id,
done_date,
function,
last_update,
object_type,
start_date,
status
;

UPDATE examples​

Update a user. Updates the home directory, SSH state or state of the user. Set state to off to disable the FTP and SSH access of the user.

UPDATE ovh.hosting_web.users
SET
home = '{{ home }}',
ssh_state = '{{ ssh_state }}',
state = '{{ state }}'
WHERE
login = '{{ login }}' --required
AND service_name = '{{ service_name }}' --required;

DELETE examples​

Delete a user. Permanently deletes the user and returns the task. The files in its home folder are kept.

DELETE FROM ovh.hosting_web.users
WHERE login = '{{ login }}' --required
AND service_name = '{{ service_name }}' --required
;