Tuesday, February 22, 2011

Linux - Allow SSH access to Linux Server for new user account

To allow SSH access to create user

AllowUsers user1 user2
This directive is opposite of DenyUsers directive.

AllowGroups group1 group2
This directive is opposite of DenyGroups directive.

You should always block access to root user/group:
Open /etc/ssh/sshd_config file:

# vi /etc/ssh/sshd_config

Make sure at least one user is allowed to use 'su -' command.

Save the file and restart the sshd service.

Thursday, February 17, 2011

Wednesday, February 9, 2011

Mysql - to check respective MySQL table size in the specific database

SELECT table_name,
       concat(round(sum(table_rows)/1000000,2),'M') rows,
       concat(round(sum(data_length)/(1024*1024*1024),2),'G') data,
       concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx,
       concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size,
       round(sum(index_length)/sum(data_length),2) idxfrac
       FROM information_schema.TABLES
WHERE table_schema = "<specific_database_name>"
group by table_name;



NOTES:
<specific_database_name> - replace this with your database name

MySQL - to check dabatase size

 SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES WHERE table_schema = '&lt;DATABASE NAME&gt;' GROUP BY table_schema ;