David Ghedini

Linux, Java, Oracle, and PostgreSQL


David Ghedini

Thursday Jun 14, 2012

ProFTP Offline After Changing User Name (WHM/cPanel).


WHM 11.32.3 (build 19)
CENTOS 5.8 x86_64 xenpv
ProFTPD Version 1.3.4

I was required to change the user name on an existing cPanel account in WHM.

I did this via Modify Account and all seemed well.

I then noticed that ProFTP had gone offline.

Attempting to restart from WHM gave the following:

ftpserver has failed, please contact the sysadmin.


So, checking Messages for proftpd:

root@s27 [~]# cat /var/log/messages | grep proftpd


The following error was found:

Jun 9 19:39:01 s27 proftpd[17985]: Fatal: AuthUserFile: unable to use relative path for AuthUserFile '\/etc\/proftpd/username'. on line 187 of '/etc/proftpd.conf' 


When the user name was changed, backward slashes were added to the AuthUserFile path (AuthUserFile \/etc\/proftpd/username).

Opening proftp.conf in vi:

<VirtualHost 1.2.3.4>
  ServerName ftp.domain.com
  AuthUserFile \/etc\/proftpd/username
  MaxClients 3 "Sorry, this ftp server has reached its maximum user count (%m).  Please try again later"
  DirFakeGroup On ftpgroup
  DirFakeUser On ftpuser
  DefaultRoot ~

  <IfModule mod_tls.c>
      TLSEngine on
      TLSRequired off
      TLSRSACertificateFile /etc/ftpd-rsa.pem
      TLSRSACertificateKeyFile /etc/ftpd-rsa-key.pem
      TLSVerifyClient off
      TLSCipherSuite HIGH:MEDIUM:+TLSv1:!SSLv2:+SSLv3
  </IfModule>

  <Directory />
    AllowOverwrite                on
    HideGroup wheel
    HideUser root
  </Directory>
  <Anonymous /home/securelo/public_ftp>
    UseFtpUsers                   on
    RequireValidShell             off
    UseFtpUsers                   on
    RequireValidShell             off
    User                          ftp
    Group                         ftp
    UserAlias                     anonymous ftp
    DisplayLogin                  welcome.msg
    # DisplayChdir                  .message true
    
    <Limit WRITE>
      DenyAll
    </Limit>

    <Directory incoming>
      <Limit STOR>
        AllowAll
      </Limit>
      <Limit WRITE READ>
        DenyAll
      </Limit>
    </Directory>
  </Anonymous>
</VirtualHost>


I removed the backward slashes from the AuthUserFile path (\/etc\/proftpd/username) and was able to start ProFTP.

Odd.

HTH someone else....

Bookmark and Share



Wednesday Mar 02, 2011

How to Enable or Disable Root login via SSH

This post will cover how to enable (or disbale) Root login via SSH.

It's always best practice that any machine on the internet not allow direct Root login via SSH.

To allow Root to log in, we need to update our sshd_config file located at /etc/ssh/sshd_config.

To update this file, we need to switch over to Root:

[admin@blanche ~]$ su root
Password:
[root@blanche ~]#


Go to the /ect/ssh directory:

[root@blanche ~]# cd /etc/ssh
[root@blanche ssh]#


Now, let's edit our sshd_config file using vi:

[root@blanche ssh]# vi sshd_config


Look for the following section (about 1/3 of the way down):

#LoginGraceTime 2m
PermitRootLogin no


Hit "i" to insert and then change the value for PermitRootLogin from no to yes.

Hit Escape and then :wq! to save changes and close the file.

Finally, still as Root, we need to restart SSHD using /etc/init.d/sshd restart.

[root@blanche ssh]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]


Exit your session, open a new terminal and confirm you are now able to login as Root:

login as: root
root@blanche's password:
Last login: Mon Jun 28 16:21:53 2010
[root@blanche ~]#


To prevent Root log in, simply set to (or change to) PermitRootLogin no in your sshd_config

Bookmark and Share



How to Set Hostname on CentOS

This post will cover how to set the server hostname on CentOS.

Well, I could have sworn when I ordered this VPS that I entered the hostname I wanted in the order form. I guess I must have been hallucinating....

Begin by checking the existing hostname using the hostname command.

login as: root
root@vps12's password:
Last login: Mon Jun 28 16:21:53 2010
[root@vps12 ~]# hostname
vps12


We can also check via sysctl kernel.hostname

[root@vps12 ~]# sysctl kernel.hostname
kernel.hostname = vps12


The actual hostname I need to set for this server is blanche.mydomain.net

I can set the hostname initially using the hostname command followed by the desired hostname.

[root@vps12 ~]# hostname blanche.mydomain.net


This will set the hostname:

[root@vps12 ~]# hostname
blanche.mydomain.net


However, once the server is rebooted, the hostname will revert to it's previous setting (vps12).

To permanently change the hostname, I need to edit the network file at /etc/sysconfig/network.

So,

[root@vps12 ~]# cd /etc/sysconfig
[root@vps12 sysconfig]# vi network


The Network file will look as so.

NETWORKING=yes
HOSTNAME=vps12
GATEWAYDEV=eth0
GATEWAY=192.168.0.1


Hit 'i' to insert and change the HOSTNAME value to your FQDN, in my case, blanche.mydomain.net

Hit Escape, then :wq to save and exit.

Check that the hostname is properly set:

[root@vps12 sysconfig]# hostname
blanche.mydomain.net
[root@vps12 sysconfig]# sysctl kernel.hostname
kernel.hostname = blanche.mydomain.net


Finally, if we log out, and log back in using a new session, we see I am now root@blanche:

login as: root
root@blanche's password:
Last login: Mon Jun 28 16:21:53 2010
[root@blanche ~]#  


To properly check, you may wish to reboot the server.

Bookmark and Share




Main Menu

Built With

Search

Pages

LinkedIn

Tag Cloud

Hosted by:

Navigation

Visitors

Sponsors

petiole Cloud

Feeds