Skip to main content

Posts

Showing posts with the label linux

User account Lock/Unlock / Disable and enable

User account Lock/Unlock / Disable and enable Ex - Username - testing Lock command =---------- passwd -l testing or usermod -L testing unlock command ================= passwd -u testing or usermod -U testing Disable and Enable ==================== The following will lock an account Code: passwd -l testing You could also change the users shell to /bin/false if you don't want them to log in Code: usermod -s /bin/false testing Enable the account usermod -s /bin/bash tesing

Linux Delete Symbolic Link ( Softlink )

Delete Symbolic Link File Use the following syntax:   rm linkname unlink linkname Cd to /tmp cd /tmp ln -s /etc/resolv.conf dns ls -l dns Outputs: lrwxrwxrwx 1 vivek vivek 16 2009-08-16 04:28 dns -> /etc/resolv.conf Now delete dns symbolic link:   rm dns OR unlink dns Delete Symbolic Link Directory Use the following syntax:   rm linkDirName unlink linkDirName Note: Avoid appending / at the end of linkDirName. Cd to /tmp: cd /tmp ln -s /etc test ls -l test Sample Output: lrwxrwxrwx 1 vivek vivek 4 2009-08-16 04:31 test -> /etc Now delete test symbolic link directory:   rm test OR unlink test

3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

ssh-keygen  creates the public and private keys.  ssh-copy-id  copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys. This article also explains 3 minor annoyances of using ssh-copy-id and how to use ssh-copy-id along with ssh-agent. Step 1: Create public and private keys using ssh-key-gen on local-host jsmith@local-host$ [Note: You are on local-host here] jsmith@local-host$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/jsmith/.ssh/id_rsa): [Enter key] Enter passphrase (empty for no passphrase): [Press enter key] Enter same passphrase again: [Pess enter key] Your identification has been saved in /home/jsmith/.ssh/id_rsa. Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub. The key fingerprint is: 33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host Step 2: Co...

Change your Hostname without Rebooting in RedHat Linux

cd /etc/sysconfig vi network Look for the HOSTNAME line and replace it with the new hostname you want to use. In this example I want to replace localhost with redhat9. HOSTNAME=redhat9 When you are done, save your changes and exit vi. Next we will edit the /etc/hosts file and set the new hostname. vi /etc/hosts In hosts, edit the line that has the old hostname and replace it with your new one. 192.168.1.110 redhat9 Save your changes and exit vi. The changes to /etc/hosts and /etc/sysconfig/network are necessary to make your changes persistent (in the event of an unscheduled reboot). Now we use the hostname program to change the hostname that is currently set. hostname redhat9 And run it again without any parameters to see if the hostname changed. hostname Finally we will restart the network to apply...