Categories
Uncategorized

Passwordless ssh login to a server

1.- on the client side, generate the public ssh key
Press enter at each prompt.
[su_note]ssh-keygen[/su_note]

2.- Transfer pub key to remote server
[su_note]ssh-copy-id -i ~/.ssh/id_rsa.pub username@remotehost [/su_note]

3.- now test, it, from the client side

[su_note] ssh username@remote [/su_note]
or if the username on the remote server is the same as the username on the client side, use
[su_note]ssh remoteserver [/su_note]

Categories
Uncategorized

Configure NIS client with NFS share on Ubuntu 16.04

1.- Edit /etc/hosts and and nis server host/ip
[su_note]
#localhost is your linux client hostname
127.0.1.1  localhostname.domain.com  localhost
192.168.1.10  mynisvr.test.com
[/su_note]
2.- install portmap, ypbind, nfs-common and nis
[su_note] apt-get install nfs-common nis -y [/su_note]

2.1 to mount nfs home dirs install autofs5
[su_note] apt install autofs5 [/su_note]
2.a) Enter your nis domain, i.e tempnet or whatever your nis domain server is. To find out the domain name, from another client computer that’s already connected to a nis server, do [su_note] cat /etc/defaultdomain [/su_note]
3. Edit /etc/yp.conf
[su_note] ypserver 192.168.1.11
ypserver 192.167.1.12[/su_note]
4. Edit /etc/passwd,  /etc/group and /etc/shadow and add the following at the end of the file.
For passwd with six :[su_note] +::::::[/su_note]
For  group with 3 :[su_note]+:::[/su_note]
For shadow with 8 : [su_note]+::::::::[/su_note]
5: edit /etc/nsswitch.conf
[su_note]
automount:  files nis
netgroup:      nis
[/su_note]
6. Configure Ubuntu for manual login by creating a nis file:  This only works for  the gnome desktop.
/etc/lightdm/lightdm.conf.d/nis.conf
[su_note]
[SeatDefaults]
greeter-show-manual-login=true
user-session=true
[/su_note]

For Unity, the file location is sudo /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
[su_note]
[SeatDefaults]
greeter-show-manual-login=true
guest-session=false
[/su_note]

6: Troubleshooting:
6.1 Test connection using ypwhich fails, export firewall from a known client.
[su_note]iptables-save > firewallclientconfig.txt[/su_note]
now import on new client
[su_note] itables-restore < firewallclientconfig.txt[/su_note]
6.2 With Ubuntu 16.04 the rpcbind daemon won’t start before the nis service. Run the following to fix it.
[su_note]sudo systemctl add-wants multi-user.target rpcbind.service[/su_note]
You should get a message that says
[su_note]Created symlink from /etc/systemd/system/multi-user.target.wants/rpcbind.service to /lib/systemd/system/rpcbind.service[/su_note]

Another troubleshooting step: do a
[su_note] su – remoteusername [/su_note]
if it complains about “cannot execute /bin/tcsh no such file or directory”, do
[su_note] apt-get install tcsh [/su_note]

If you cannot login using your nis credentials. Press Alt + F2. Use your local credentials to login and then add your nis username to the sudoers list.
[su_note]
sudo adduser nisusername sudo
[/su_note]

Log out and log back using your nis credentials. You should be able to check the logs for further troubleshooting /var/log/syslog   /var/log/auth.log   /var/log/lightdm/lightdm.log

If you are upgrading from Trusty (14.04) to Xenial (16.04), you may need to install gnome desktop.
[su_note]
sudo apt install ubuntu-gnome-desktop
[/su_note]

Check if mount points are ok.
[su_note] showmount -e NFS-server-IP-addr [/su_note]

Categories
Uncategorized

Install Ubuntu Mate on Ubuntu 16.04.3

apt-get install ubuntu-mate-desktop
apt-get install mate

 

Categories
Uncategorized

Installing Nagios 4.3.2 on Ubuntu 16.04

1.- Install LAMP

2.-Install additional dependencies, can be install when setting up LAMP

[su_note]sudo apt-get install wget build-essential apache2 php apache2-mod-php7.0 php-gd libgd-dev unzip[/su_note]

3.- Download Nagios Core 4.3.2 and Nagios Plugins

[su_note]wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.3.2.tar.gz wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz[/su_note]

4.- Create nagios user and group memberships

[su_note]useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagios,nagcmd www-data[/su_note]

Nagios Core Install:

[su_note]
tar zxvf nagios-4.3.2.tar.gz
tar zxvf nagios-plugins-2.2.1.tar.gz

cd nagios-4-3-2
./configure –with-command-group=nagcmd -–with-mail=/usr/bin/sendmail –with-httpd-conf=/etc/apache2/
[/su_note]

If the above step fails due to error: unrecognized option: `-–with-mail=/usr/bin/sendmail’ , then run

[su_note]./configure –with-command-group=nagcmd –with-httpd-conf=/etc/apache2/
[/su_note]

You should get a summary such as:

*** Configuration summary for nagios 4.3.2 2017-05-09 ***:

General Options:
————————-
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Install ${includedir}: /usr/local/nagios/include/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/apache2/
Mail program: /usr/bin/mail
Host OS: linux-gnu
IOBroker Method: epoll

Web Interface Options:
————————
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):

Review the options above for accuracy. If they look okay,
type ‘make all’ to compile the main program and CGIs.

…Continue with Install

[su_note]
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

The following step failed
sudo a2ensite nagios
Possible solution is to do: ln -s /etc/apache2/nagios.conf /etc/apache2/sites-available/nagios.conf
then do:
sudo a2ensite nagios.conf
sudo a2enmod rewrite cgi
[/su_note]

You’ll get a message:
To activate the new configuration, you need to run:
service apache2 restart
Wait, don’t run this command yet

[su_note]
sudo cp /etc/init.d/skeleton /etc/init.d/nagios
sudo nano /etc/init.d/nagios

#Add the following lines

DESC=”Nagios”
NAME=nagios
DAEMON=/usr/local/nagios/bin/$NAME
DAEMON_ARGS=”-d /usr/local/nagios/etc/nagios.cfg” PIDFILE=/usr/local/nagios/var/$NAME.lock
[/su_note]

[su_note]
systemctl restart apache2
systemctl start nagios <– This step failed. Working on a solution
[/su_note]

Create a nagios admin account:

[su_note]
htpasswd –c /usr/local/nagios/etc/htpasswd.users nagiosadmin
[/su_note]

Nagios Plugin installation:

[su_note]
cd /tmp/nagios-plugins-2.2.1
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
[/su_note]

Verify nagios configuration:

[su_note]
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
#you should get
Total Warnings: 0
Total Errors: 0

[/su_note]

Start nagios:
[su_note]/etc/init.d/nagios start[/su_note]

Nagios service setup: The following steps didn’t work. Working on a solution

[su_note]
chkconfig –add nagios
chkconfig –level 35 nagios on
chkconfig –add httpd
chkconfig –level 35 httpd on
sudo update-rc.d nagios defaults

[/su_note]

Login with nagiosadmin
https://servername/nagios