WebSphere Issues

23/04/2017

chmod, chown, chgrp commands in Linux

Filed under: Other — Ishtiaque @ 12:35 pm
  • Octal -> Read(4), Wite (2), Execute (1)
  • Symobolic -> o+rwx, g+rwx, u+rwx = o=owner, g=group, u=user/other

chmod:

  • chmod ou+x,g-w file   (‘owner’ and ‘user’ -> execute and group -> remove write)
  • chmod 755 file             (Owner -> rwx (7); Group-> rx; Others-> rw)

chown:

  • chown user afile (Changes user owner)
  • chown user:grp file (Changes user and group ownership togather)
  • chown -r user:grp dir (Changes user and group on subdirectores)

chgrp:

  • chown grp file (Changes group owner)

getfacl:

  • getfacl file (View permission assigned on a file)
  • getfacl dir (View permission assigned on a directory)

setfacl:

  • setfacl -m u:user:rx /tmp/file

20/04/2017

User and group management in Linux

Filed under: Other — Ishtiaque @ 11:37 am

User commands:

  • useradd user1 (-d /var/user1 changes home directory)
  • userdel -r user1 (removes user and its home/mail folders)
  • usermod -a -G grp1, grp2 user1 (Adds users to grp1 and grp2)
  • chage -l user1 (List user details)
  • Files: /etc/passwd and /etc/shadow
  • cut -f 1,6 -d “:” /etc/passwd (List all users and their home directory)

Group commands:

  • groupadd grp1
  • groupdel grp1
  • groupmod
  • groups user1 OR id -Gn (List groups of a user)
  • /etc/group and /etc/gshadow

19/04/2017

Ubuntu Advanced Packaging Tool commands

Filed under: Linux, Other — Tags: — Ishtiaque @ 12:46 pm

1. apt-cache:

-> Search the repository for a package

  • apt-cache search apache2
  • apt-cache -n kernel
  • apt-cache pkgnames kernel

-> Display info of a package

  • apt-cache show apache2
  • apt-cache showpkg apache2

-> List dependent packages

  • apt-cache depends apache2

-> Search package based on file

  • apt-file search apache2.conf
  • apt-file list apache2

2. apt-get
-> Update: Synchronize the package index files with the repository source:

  • apt-get update

-> Apply all available updates to packages already installed:

  • apt-get upgrade (-u switch will show upgraded packages)
  • apt-get dist-upgrade (Remove obsolete packages)

-> Install

  • apt-get install apache2

-> Uninstall or Remove

  • apt-get remove apache2
  • apt-get –purge remove apache2 (Removes config files also)
  • apt-get autoremove (Remove package not needed anymore)

-> Clean cache

  • apt-get clean

RPM commands

Filed under: Linux — Tags: , — Ishtiaque @ 11:58 am

– Install a package

  • rpm -ivh httpd-2.4.6-45.el7.centos.4.x86_64

– Uninstall or Remove a package

  • rpm -e httpd

– Upgrade a package

  • rpm -Uvh httpd-2.4.6-45.el7.centos.4.x86_64

– Query package

  • rpm -qa | grep httpd*
  • rpm -q httpd

– Search based on config file

  • rpm -qf /etc/httpd/conf.d/welcome.conf

– List files installed by the package

  • rpm -ql httpd
  • rpm -qil httpd

– Show info a the package

  • rpm -qi rpm

– Verify packages

  • rpm -Va
  • rpm -V httpd

– The standard naming format:

  • <name>-<version>-<release>.<distro>.<architecture>.rpm
  • sed-4.2.1-10.e16.x86_64.rpm

Yum commands

Filed under: Linux — Tags: , — Ishtiaque @ 10:38 am

1. Install or update a particular package

  • yum install httpd
  • yum update httpd

2. Check and install updates

  • yum check-update
  • yum list update
  • yum update

3. List available or installed packages

  • yum list installed
  • yum list available
  • yum list installed “kernel*”
  • yum list “kernel*”

3. Search a package

  • yum search httpd

4. Get details of a package

  • yum info httpd

5. List dependencies of a package

  • yum deplist httpd

6. Group of packages

  • yum grouplist
  • yum groupinfo “GNOME Desktop”
  • yum groupinstall “GNOME Desktop”
  • yum groupremove “”GNOME Desktop”

7. Repository list

  • yum repolist

7. Config files

  • /etc/yum.conf
  • /etc/yum.repos.d/

18/04/2017

Script to check connectivity between single or multiple hosts – telnet

Filed under: Other — Ishtiaque @ 11:07 am

Alternate to telnet commands to check single host:

  • echo > /dev/tcp/{host}/{port} && echo “SUCCESS” || echo “FAILED”
  • timeout 1 bash -c ‘(If output 0 then Sucess else Failed)

Script to check connectivity between multiple hosts:

#!/bin/bash
SRC_HOSTS=(‘src1’ ‘src2’ ‘src3’ ‘src3’ ‘src4’)

DEST_HOSTS=(‘dest1’ ‘dest2’)
PORT=1521
TIMEOUT=1

for src in ${SRC_HOSTS[@]}; do
echo “—Testing connection from $src—”

for dest in ${DEST_HOSTS[@]}; do
ssh root@$src “timeout $TIMEOUT bash -c ‘ /dev/null 2>&1

if [[ $? -eq 0 ]]; then
echo “SUCCESS: $dest”
else
echo “FAILED: $dest”
fi
done
done
exit 0

Note: You could use IP address instead of hostnames in SRC_HOST and DEST_HOST variables.

05/04/2017

No supported authentication methods available (Server sent: publickey)

Filed under: Other — Ishtiaque @ 2:24 pm

First of all make sure you have setup ssh keys correctly by following the post:

https://websphereissues.wordpress.com/2014/11/25/add-ssh-keys-for-a-user-in-linux/

In /var/log/secure, if you noticed the error “Authentication refused bad ownership or modes for directory“, then you need to set “StrictModes no” in /etc/ssh/sshd_config file and run “service sshd” restart command to resolve this issue.

03/04/2017

Assign a static IP in Ubuntu

Filed under: Linux — Ishtiaque @ 10:15 am

Edit the file /etc/network/interfaces

iface eth0 inet static
address 192.168.254.201
netmask 255.255.255.0
gateway 192.168.254.2
dns-nameservers 192.168.254.2 8.8.8.8

Blog at WordPress.com.