Posts tagged: linux

/proc/kcore and other kcore files

When doing a df / du combination to try and free up unused disk space on a Linux system, /proc/kcore or other ‘kcore’ files turn up.

/proc/kcore:

  • Is a virtual file that represents all the physical memory on a given system (as a file that can be written and read)
  • Does not actually consume physical space on the file system – even though ‘du’ reports it a regular file
  • Should never be deleted

Variants of the ‘kcore’ file may appear in other places on the file system. In every case they mirror the real ‘kcore’ file. For example, any service that uses a ‘chroot’ environment will like mount this file in its own namespace – e.g. /var/named/chroot/proc/kcore. Run the ‘mount’ command to see this.

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/proc on /var/named/chroot/proc type none (rw,bind)

Linux/Unix set date and time

To set the date and time in Unix / Linux

date MMDDhhmmCCYY.ss

To set hardware clock from system date and time

setclock

NTP configuration – /etc/ntp.conf, /etc/sysconfig/ntpd

Start the NTP service

/sbin/service ntpd start

Linux NFS Mounts

/usr/sbin/showmount

To see what NFS is explicitly exporting:

/usr/sbin/showmount -e

CISCO Linux VPN Client

Extracted from LINUX Cisco VPN Client Installation

it appears that the VPN client will not work when the operating system is running in “Security Enhanced” mode (SELinux). We suggest that you not run the system in this mode, if you plan on using the vpn client. To do this, cd to the /etc/selinux folder … then edit the config file as follows (change “enforcing” to “disabled”). In this example, it’s simply been commented out:

[root@linuxbox selinux] more config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
# SELINUX=enforcingSELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.SELINUXTYPE=targeted

Configuring the CISCO VPN client on Linux

Unix/Linux run levels

See Wikipedia entry.

Standard Unix/Linux run levels

ID Name Description
0 Halt Halt system
1 Single-User Mode Does not: configure network interfaces, start daemons, or allow non-root logins
2 Default Multi-user mode Does not: configure network interfaces or start daemons
3 Multi-user mode + network Starts the system normally
4 Unused User defined
5 X11 Runlevel 3 + Display manager
6 Reboot Reboot Linux

Unix / Mac / DOS / Windows Line Termination

LF = ’0x0A’  o’012′  ‘\n’
CR = ’0x0D’  o’015′  ‘\r’

Unix, Linux – LF
MAC – LF
Windows – CR LF

REMEMBER!!!!

FTP on raw text files CONVERTS LINE TERMINATION between platforms. Doesn’t if text files are zipped.

Linux – Managing Users and Groups

Commands to manage users In Linux

To add a user

adduser -m -g PRIMARY_GROUP -G  ADDITIONAL_GROUPS -s /bin/bash -c "USER REAL INFO" USER

Options:

  • -d home directory
  • -s starting program (shell)
  • -p password
  • -g (primary group assigned to the users)
  • -G (Other groups the user belongs to)
  • -m (Create the user’s home directory

To update a user

usermod -m -g PRIMARY_GROUP -G  ADDITIONAL_GROUPS -s /bin/bash USER

Options:

  • -d home directory
  • -s starting program (shell)
  • -p password
  • -g (primary group assigned to the users)
  • -G (Other groups the user belongs to)

To delete a user

userdel -r USER

Options:

  • -r remove home directory

To add a group

groupadd [-g GROUP_ID] GROUP_NAME

Related commands:

  • useradd – Add a user to a group
  • userdel – Remove a user from a group
  • groupdel – Delete a group

Bind on RedHat

BIND on RedHat – I

BIND on RedHat – 2

These instructions worked except for the points noted below. You must change the serial number in the zone file initially and after every subsequent change else BIND will not see the changes.

Serial numbers must increase and not exceed a maximum – easiest is to use YYYYMMDDNN format. If you use this format and edit with emacs, emacs automatically increments the number for you.

Also, zone file changes have to be copied from /var/named to /var/named/chroot/var/named.

Start/stop/reload bind service

/etc/init.d/named [start|stop|reload]

RedHat Linux Version

To display OS version at prompt type:

cat /etc/redhat-release

WordPress Themes