Posts

Showing posts with the label Linux

How to set Grub Password in UBUNTU 18.03 (Password protect Boot Loader)

Image
  First, open a terminal from Ubuntu’s applications menu Take backup of two files :  cp /etc/grub.d/40_custom /etc/grub.d/40_custom.old and  cp /boot/grub/menu.lst /boot/grub/menu.lst.bkp Generating a Password Hash :  Just type  grub-mkpasswd-pbkdf2  and press Enter Generating a Password Hash 4.  Setting a Password:  Type  sudo vi /etc/grub.d/40_custom  to open the 40_custom file in the Nano text editor. This is the place where you should put your own custom settings. They may be overwritten by newer versions of Grub if you add them elsewhere. Save password in /etc/grub.d/40_custom scroll down to the bottom of the file and add a password entry in the following format: set superusers=”name” password_pbkdf2 <superusers_name>[long string from earlier] password Entry in /etc/grub.d/40_custom file 5. Open /boot/grub/menu.lst file and follow the below steps a. Generate md5 password :  echo -n <password> | md5sum b. Ope...

Useful network command for Linux

  nc (netcat) command : used for port scanning, port redirection, as a port listener $ nc -v -w 2 z <ip-address> 22 #scan a single port $ nc -v -w 2 z <ip-address> 22 80 #scan multiple ports $ nc -v -w 2 z <ip-address> 20–25 #scan range of ports nmap command : Nmap is used for exploring networks, perform security scans, network audit and finding open ports on remote machine The Nmap tool offers various methods to scan a system. In this example, I am performing a scan using hostname to find out all open ports, services and MAC address on the system # nmap [Scan Type(s)] [Options] {target specification} # yum install nmap [on Red Hat based systems] $ sudo apt-get install nmap [on Debian based systems] with “-v” option is giving more detailed information about the remote machine. nmap <hostname or IP> nmap -v <IP> You can scan multiple hosts by simply writing their IP addresses or hostnames with Nmap. nmap <IP1><IP2> nmap -sU <IP...

Restore the size of USB drive in Linux

  Run  lsblk  command to find outUSB partition. In this case you see the USB flash drive is sdb so you  VERY CAREFULLY  run: #sudo dd if=/dev/zero of=/dev/sdb count=100 Create a new partition table  in the format you like: #dd if=/dev/zero of=/dev/sdb bs=32k count=1 Create mounting point: #sudo mkdir /media/external Mount the Drive:  We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point): #sudo   mount -t vfat /dev/sdb /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137 OR If the device is formatted with NTFS , run: #sudo mount -t ntfs-3g /dev/sdb1 /media/external Note: You must have the ntfs-3g driver installed Unmounting the Drive : #sudo umount /dev/sdb ENJOY

Configure Ceph Cluster in UBUNTU 18.0

  Pre-requisites: 1. In this case, 3 mon and 3 mgr node (node01, node02, node03) will available. 2. OSD will be placed on a different node (node04 node05 node06) 3. Install Ceph to all Nodes from the Admin Node and copy keyrings to all nodes 4. For PG CALC use  https://ceph.io/pgcalc/ STEPS TO CONFIGURE CEPH CLUSTER Add a user for Ceph admin on all Nodes and Grant root privilege to Ceph admin user just added above with sudo settings. And also install required packages to all # apt  -y install openssh-server python-ceph # echo  -e ‘Defaults:ubuntu !requiretty\nubuntu ALL = (root) NOPASSWD:ALL’ | tee /etc/sudoers.d/ceph # chmod  440 /etc/sudoers.d/ceph Passwordless between each node: #ssh-keygen #ssh-copy-id node01 #ssh-copy-id node02 #ssh-copy-id node03 #ssh-copy-id node04 #ssh-copy-id node05 Install Ceph to all Nodes from Admin Node (node01). So install below commands to Admin node (node1) # sudo   apt  -y install ceph-deploy ceph-common ceph-m...

Configuring Shared Folders in VMWare Workstation with a UBUNTU Guest OS and Windows Host

Image
  Start VMWare Workstation, then power on Ubuntu guest OS Go to settings and choose select options tab ->shared Folderes go to settings->options->Shared folders 3. Add shared folder created on the windows machine with full access and should be always enabled choose Shared Folder 4. Go to guest OS (Ubuntu 18.0) and run the below commands (Install apt install open-vm-tools if not avialable) #sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other # vmware-hgfsclient #sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other # vmware-hgfsclient 5. Enjoy

Speed Up Slow WiFi Connection In Linux Ubuntu18.x

  There are some tricks which speed up slow WiFi connection in Linux Ubuntu18.04 Solution 1 . Trick is to  force disable the  802.11n  protocol . Even after so many years, m o st of the world runs 802.11a,b and g. While 802.11n provides better data rate, not all the routers support it, especially the older ones. It has been observed that disabling the 802.11 n helps speed up the wireless connection in Ubuntu and other OS. Open the terminal and use the following command: sudo rmmod iwlwif sudo modprobe iwlwifi 11n_disable=1 you should make the changes permanent by using these commands: sudo su echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf Restart your computer and live your life at full speed. Solution 2. Fix the bug in Debian Avahi-daemon: To fix this bug, you have to edit the nsswitch configuration file. Open a terminal and use the following command: sudo gedit /etc/nsswitch.conf This will open the configuration file in gedit so ...

How to set the Proxy for Docker in Linux

  Systemd Docker Service In order to the set the proxy for Docker, you will need to create a configuration file for the Docker service. No configuration files exist by default, so one will have to be created. All Systemd service configuration are stored under /etc/systemd/system. In order to keep things organized,  we can create a child directory docker.service.d, rather than creating a file called /etc/systemd/system/docker.service . Within this configuration file, we can set our HTTP and HTTPS proxy. We can also set our NO_PROXY value, too. Creating Proxy Configuration Create a new directory for our Docker service configurations. sudo mkdir -p /etc/systemd/system/docker.service.d 2. Create a file called proxy.conf in our configuration directory. sudo vi /etc/systemd/system/docker.service.d/proxy.conf 3. Add t h e following contents, changing the values to match your environment. [Service] Environment=”HTTP_PROXY=http://myproxy.hostname:8080" Environment=”HTTPS_PROXY=...