Knowledge Base
MilesWeb / DirectAdmin, How-Tos, Web Hosting FAQ

How to Block DirectAdmin Commands for Users?

Approx. read time : 3 min

Server administrators exercise the ultimate authority over a hosting server. They can even grant or deprive the user accounts of some of that authority. Admins of DirectAdmin servers can exercise this power as they can block some of the commands that users can run.

With SSH Access, Admins can:

Block DirectAdmin Commands for all the User Accounts

The never_commands setting in /usr/local/directadmin/conf/directadmin.conf file will block commands globally and for all the users on the server.

The syntax to block commands with the never_commands setting:

never_commands=COMMAND

For example,

never_commands=CMD_ACCOUNT_ADMIN:CMD_API_ACCOUNT_ADMIN

It will block the commands to create new admin accounts.

 

For the command to take effect, restart DirectAdmin:

service directadmin restart

 

Block the DirectAdmin Commands for Specific Users.

For specific users, blocking commands requires a bit of preparation.

1. Create files commands.allow and commands.deny. These files are very similar to the CSF files – csf.allow and csf.deny.

/usr/local/directadmin/data/users/USERNAME/commands.allow
/usr/local/directadmin/data/users/USERNAME/commands.deny

Let’s see what to put in these files-

  • commands.allow: The DirectAdmin commands that the user is allowed to use.
  • commands.deny: The DirectAdmin commands you want to deny/block for the user.
Rules to Create the commands.allow and commands.deny Files
  1. Enter one command per line.
  2. If a command is present in both commands.allow and commands.deny files, the user is allowed to use the command.
  3. If the commands.allow file is empty, i.e. there are no commands in it, the system will block every command for the user.
  4. Users cannot use the commands exceeding their access level even after adding them to commands.allow.

The moment a user tries to execute a command you have denied or blocked, DirectAdmin will give an error message.

Here are the links where you can find all the DirectAdmin commands:

https://www.directadmin.com/api.html
https://www.directadmin.com/search_versions.php?help=no&versions=yes&query=CMD_API_
https://www.directadmin.com/search_versions.php?help=no&versions=yes&query=CMD_ 

You can block these commands globally or for a specific user on your DirectAdmin server.

Prasad is a business grad specialized in Marketing. He has garnered experience as a technical content writer and a digital marketer that he brings out in his work. He likes reading classics and travel in his free time.

Trusted By Thousands of Clients & Big Businesses

We highly appreciate the kind and stellar feedback we receive from our customers. Delivering the best is our goal! MilesWeb is rated Excellent out of 5 based on reviews. Read more reviews.

Excellent
Based on reviews
2 hours ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
4 hours ago
Milesweb is superb Hosting pro...
Milesweb is superb Hosting provider ever, their Support team is amazing!!!...
Abhishek Singh
15 hours ago
Great support in great timing...
We need urgent assistance on changes in a primary domain on our client's Cpanel accounts and reached...
Riyaju Deen
21 hours ago
Best Website Hosting platform ...
I was new on MilesWeb. And needed help on multiple areas from setting up to getting started with cre...
Harshada
1 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
1 days ago
the team is very supportive th...
the team is very supportive though at times effort needs to be made to make understand the problem s...
Suree Sharma
1 days ago
I am using miles web for 3plus...
I am using miles web for 3plus years, very quick and perfect support by the team, they helped me man...
Sri Raghav
2 days ago
The service is good...
The service is good. They are answering with patience and doing the needful as soon as possible....
MR
2 days ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
3 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
4 days ago
positively helped me with find...
positively helped me with finding insecure content on my website causing SSL to not work properly on...
Thaviraj Junglee
4 days ago
Exceptional support, Truly Pra...
I had opted for the basic wordpress hosting plan as I intended to experiment with various plug-ins. ...
Aseem Chandna