Krissy's Question and Answer
From Free Knowledge Base- The DUCK Project: information for everyone
____________________________ / \ ( Krissy's Question and Answer ) \____________________________/ Q&A CORE FILES (finding core files everywhere on the file system) ---------- Q: what are those core files? A: do "file core" and it'll tell you who made the core file. Q: what is causing them, improper shutdown maybe? A: more like a dodgy/corrupt library or something. when a *nix program crashes, it creates a core file that someone smart can use to help debug the program or determine why it crashed. Q: is it always the same program that is dumping core files? A: I would say that this is a glibc issue. you could do a 'gdb /usr/bin/who core' on that core file. Q&A UPGRADED MEMORY (upgraded my ram but linux can't see it) ---------- Q: how do I get linux to see all of my ram, I just upgraded? A: edit /etc/lilo.conf add: 'boot: linux mem=127M' (always 1 mb less than actual system ram) Q&A BASH SHELL QUESTIONS ---------- Q: how do I filter my log file when viewing it with tail -f? A: filter out individual lines with grep. parsing within the line is not possible using sed when using tail -f because sed does not seem to flush. Instead use gawk. Here is an ex: tail -f access_log | gawk '{sub(/GET/,"get");print}' Q: how to search for a file or pattern without locate? A: the find command can be used. here are examples: find ./ -name filename (locate filename in or below the current directory path) find / -name 'filename' 2>/dev/null (locate filename anywhere up from root filesystem) find ./ -iname 'filen*' (locate all files begin with filen and ignore case) Q: this filename begins with a dash "-" and I don't know how to delete it, rm just returns errors even when I backslash. A: rm thinks the dash indicates that you are passing a command line argument. adding two dashes behind the command tells it there will be no more arguments. To create a file and delete it when the first character is a dash: ex: touch -- -filename ex: rm -- -filename Q&A SYSTEM VERSION INFORMATION ---------- Determining Your Linux Version Q: how can I tell what linux kernel version I have? A: type 'uname -s -r' Q: how can I tell what gcc version I have? A: type 'gcc --version' Q: how can I tell what glibc version I have? A: type '/lib/libc.so.6' Q: how can I tell what vesion of xwindows I have? A: type 'XFree86 -version' or 'xdpyinfo' Q: how can I tell what Linux Distribution I have? A: sorry, there is no one super command to accomplish this. Instead you will need to make some observations. Use 'dmesg' to see if system displayed distro during boot. Check for presence of certail signature distro files, Redhat creates '/etc/redhat-release' SuSE creates '/etc/SuSE-release' Debian creates '/etc/debian_version' You may also check the issue or issue.net file type 'cat /etc/issue' Q&A SYSTEM AND TERMONOLOGY ---------- Q: what is pam.d and pam authentication for linux? A: Pluggable Authentication Modules, or PAM handles authentication for services and is used by login and su. On RH each service or application that uses pam has a configuration file in /etc/pam.d in short, pam is an authentication api Q: what are the advantages of using pam? A: allows every program to use a common API for authentication. otherwise, if a new auth mechanism is introducted, each application would have to be updated to support the new mechanism Q: what are tcp wrappers? A: access control facility for internet services or tcpd which looks at hosts.allow and hosts.deny when connection attempts handshake Q: how do you determine what services use hosts.deny and hosts.allow? A: inetd or xinetd.d servises that use tcp wrappers. remote hosts first make a handshake with tcpd, tcpd looks to the two files. Q: some services that use hosts.allow/deny arn't in xinet.d. why? A: ssh is not an xinet.d service even though it still uses tcp wrappers. there is an entry for sshd in /etc/init.d on a RH system sshd is configured to use tcp wrappers. if you build your own secure shell then you want to use tcp wrappers: ./configure --with-libwrap=/usr/local/lib/libwrap.a Q&A SYSTEM START AND SYSTEM-V ---------- Q: how does the RH System-V boot system work and how's it configured? A: the base directory /etc/init.d contains a start/stop script for each daemon process, and symbolic links in the rc<N>.d subdirs control which scripts are run when entering or leaving a runlevel. The links point back into the start/stop script in the parent dir, using a "S" prefix for the starting link, and "K" for stopping. The numeric part of the link name determines the order they start. Q&A FILE AND DIRECTORY PERMISSIONS ---------- Q: what are all the file permission letters and what does each one represent? A: letters `rwxXstugo' represent (r)=read (w)=write (x)=execute file or access directory (t)=sticky (X)=execute only if is directory or has x for someone else (s)=set user/group id on execution (setuid bit) (u)=permissions granted to user who owns file (g)="" in file group (o)=permissions for users not owning file or in group. Q: what is the setuid bit (s) and what does it do? A: setuid bit is only in the execute field. the function when used on files is different when used on directories. using setuid on an executable means when the file is executed by anyone, it will run as though you executed it (or run as the user owning the file when it's setuid) Q: how do you set the setuid bit and getgid bit for a file or directory? A: the command syntax, chmod u+s and chmod g+s or using the numeric file permissions, chmod 4777 and chmod 2777 (make the 777 whatever you want) also, in combinations like chmod 6777 setuid/setgid and read/write/execute Q&A REMOTE ACCESS AND TERMINALS ---------- Q: what remote access connection service should I use, telnet, rlogin, ssh? A: ssh2 Q: is there an alternative to putty? A: yes. Secure CRT is a commercial alternative and has more features. Q: how do I enable compression in SecureCRT for my ssh2 connection? A: in the connections dialog click the advanced button to the right of the connection hostname field. The compression may be set in teh general tab of the advanced dialog. Questions / Comments to: krissyj at robotz dot com