quinta-feira, 23 de agosto de 2012

Instalando repositório RPMFORGE no Centos

Reverse Mapping Checking - Possible Break-in Attempt Error with SSH

Reverse DNS not set up

Connecting from the command line, you might enter something like this:

1ssh my.example.com

and get some output like this:

1Connecting to my.example.com...
2reverse mapping checking getaddrinfo for 192-168-1-243.foo.bar.net failed - POSSIBLE BREAK-IN ATTEMPT!
3chris@my.example.com's password:

What this is telling us is that although we are connecting to my.example.com the IP address of the server we are connecting to actually maps back to 192-168-1-243.foo.bar.net in this example. When this actually happened to me, it's because the reverse DNS had not been set up for the server (which would map e.g. 192.168.1.243 to my.example.com as well as vice versa).

Hosts file solution

Because I knew this reverse mapping was OK, I can add an entry to my hosts file and it will stop the error message from happening. For the above example, I would add the following to my hosts file:

1192.168.1.243  my.example.com

quinta-feira, 5 de julho de 2012

Alias comandos [Linux]


vim ~/.bashrc 
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias limph='echo '' > ~/.bash_history && echo '' > ~/.history && history -c'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
~
~

domingo, 1 de julho de 2012

Setting Up a CentOS / Red Hat Linux DHCP Client



A. You can edit eth0 configuration file to switch between static and dhcp networking configuration under RHEL / Fedora or CentOS Linux. Simply edit /etc/sysconfig/network-scripts/ifcfg-eth0 file.

Backup existing static configuration

First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak

Configuring a DHCP Client

Setting up a Linux for dhcp can be done by editing file using a text editor such as vi:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Following is sample static configuration:
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:19:D1:2A:BA:A8
IPADDR=10.10.29.66
NETMASK=255.255.255.192
ONBOOT=yes

Replace static configuration with DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:19:D1:2A:BA:A8
ONBOOT=yes

Save and close the file. Just restart network service:
# /etc/init.d/network restart

quinta-feira, 21 de junho de 2012

Enable user directory on HTTPD (public_html) [Linux]

edit /etc/httpd/conf/httpd.conf

remove this line
UserDir disable

and uncomment this line
UserDir public_html

(or can just change the first line)

Then restart the server
/usr/sbin/apachectl restart

If SELinux is enabled (I did), you must also need to run these

/usr/sbin/setsebool -P httpd_enable_homedirs true
chcon -R -t httpd_sys_content_t /home/user-abc/public_html

(do not forget to change the path on the second line)

Migrando usuários entre servidores Linux

Para migrar usuários entre servidores Linux, basta você copiar as linhas referentes aos usuários que deseja migrar dos arquivos abaixo e adicionar no novo servidor que eles começam a valer, ficando faltando apenas copiar os arquivos/homes dos usuários e reiniciar o servidor.

Arquivos:

/etc/passwd - Arquivo com todos os usuários do sistema, basta você copiar as linhas referentes aos usuários que deseja migrar
/etc/shadow - Arquivo com as senhas do usuário, selecione as linhas referente aos usuários que selecionou no arquivo anterior
/etc/group - Relação de grupos, selecione os grupos dos usuários selecionados

Após selecionar os dados dos arquivos acima é só edita-los no servidor de destino e gravar.
Se você copiar os arquivos via rsync, após atualizar os arquivos de usuários/senhas, as permissões serão mantidas.