Ftp api

I don't see a direct way to "suspend" but you could just change the password on the FTP account?

This is how DA suspends FTP accounts:

http://www.directadmin.com/features.php?id=1304

It modifies the password file. Likely the API is not prepared/ready/capable of performing this.

I would either change the password or modify the path.

You could get the path first, then modify it so it is not a valid path by adding a character at the beginning or end.

Then when you unsuspend, you simply remove that character from the path
 
The easy way to suspend a password is to prepend an ! to the password field. Since the password field encode system can never have an ! in it, this has been used by admins to suspend accounts since the beginning of the 'nix systems.

The problem is that in a multi-user system managed by DirectAdmin you need to make sure that no one else is changing the file while you are. There are some editors which will manage this for you, but I generally manage passwords by just renaming the file in place (so other calls to it will fail), make the change quickly, then rename it back.

Jeff
 
Hello,

Note that CMD_API_FTP is the exact same thing as CMD_FTP... the only difference is what DA outputs.
So to do anything that CMD_FTP can already do (eg: suspend an account), you'd simply need to call the same thing, but with CMD_API_FTP instead.

Looking at the code, it might be a bit confusing, but it would be:

CMD_API_FTP
Method: POST
domain=domain.com
action=delete
suspend=anytext
select0=user

To unsuspend, same thing:

CMD_API_FTP
Method: POST
domain=domain.com
action=delete
unsuspend=anytext
select0=user

The only reason for action=delete is because it was added to the same form used to delete accounts, and was left that way to be backwards compatible.

John
 
Last edited:
Back
Top