User:Arch119

This page will be used for my personal use to store the knowledge as I gain it.

Solaris
1) Opening a xterm with exceed.

/opt/openwin/bin/xterm -ls -sb -bg black -fg green -display @d&@;

Debian GNU/Linux
1) Manipulating .deb files --> Use dpkg-deb (dpkg can also be used).

2) Installing a .deb file --> dpkg install .deb

3) Creating an image file and mounting it. see    # dd if=/dev/zero of=myfile.img bs=1M count=1 seek=2048     (for sparse files)     # mke2fs -F -j myfile.img                                   (make file system)     # mount -o loop myfile.img /mnt/myfile                      (mount this image file on a directory)

* The meaning of the 'loop' option: The loop device is a device driver that allows an image file to be mounted as though it were a normal block device. See losetup(8) or "loop devices" for details.

4) Making device system special files . Use the MAKDEV script which calls mknod(8) with the required options.    # MAKEDEV -d /dev -x console     # MAKEDEV -d /dev -x null

5) Extracting files out of debian packages: Debian packages are just "ar" archives (containing control.tar.gz and data.tar.gz) and hence can be extracted using    # ar x .deb

6) How an ELF binary is executed in Linux.    The linux linker/loader (ld-linux.so.2) searches for and loads all the required shared libraries required by the executable. During this process, it searches for the libraries in various locations and in certain order (man ld.so(8) for details). The usual order is LD_LIBRARY_PATH -> ld.so.cache -> /lib, /usr/lib. It is possible to run a binary using          * /lib/ld-linux.so.2 [OPTIONS] Executable] [ARGS

7) Linkers link against libxxxx.so (linker name) while loaders use libxxxx.so.y (so name).   Often the linker name points so name and so name points the real name.

8) Mount one directory (file) to another.  #mount --bind /.../LINUX_FROM_SCRATCH /mnt/lfs 9) User "fuser" to find out the process using a file or socket.

10) 'ksh -l' . Start Korn Shell as login shell.

Security
1) iptables also see

* iptables -L           ( List rules in all chains (i.e.INPUT/OUTPUT/FORWARD) in the current table (filter) ) * Rule To BLOCK all accesses to netbios-ssn from outside a network. iptables -A INPUT -s ! 22*.25*.2**.***/255.255.255.248 -p tcp --dport 139 -j DROP

2) hosts.deny The access to samba, swat and telnet is restricted only from my subnet which is hardcoded in hosts.deny. Change it if the subnet changes.

Redhat Linux
1) To clear the terminal --> clear

2) Finding help about emacs or other commands  Emacs-->help-->Manuals---> Browse Manuals with info....

3) Emacs switching between windows  C-x o

4) rpm options

rpm -qa  ---> rpm query all rpm -qi ---> query about package with name rpm -ql ---> query files installed by package rpm -qf  > query package containing file

rpm -qxp ---> Querying downloaded (but yet to install packages). Replace x with any query options such as 'i' or 'l'.

rpm -U ---> Updates a package.. i.e. erases previous installed versions and installs a new package.

5) apropos, whatis  ---> search command with keywords

6) makewhatis ---> make whatis database using man pages.

7) C-z --->suspending a job  jobs ---> display jobs   bg  ---> make the job a background job.   fg  ---> Similar.

8) du -s      ---> size of current directory

du -s  ---> total size of directory

9) last ---> displays a list of users last logged in  users, who, w ---> displays a list of currently logged in users

10) top ---> similar to taskmanager of windows

11) nmap localhost ---> shows open ports

10) free, vmstat, top ---> information about memory and processes.

11) /sbin/sysctl ---> change kernel parameters at runtime  /sbin/sysctl -a  -->display all parameters

12) watch ---> execute a command periodically and see the output.

13) uname -a > system info.

13.5) How X starts(in runlevel 3): when "startx" is executed, which is just a frontend to xinit, it searches for .xinitrc in user's home directory and executes it. If not it executes /etc/X11/xinit/xinitrc which might in turn execute ~/.XClients .If it doesn't find ~/.Xclients it tries to execute /etc/X11/xinit/Xclients. In RedHat this script tries to read the user's preferred Desktop environment written in /etc/sysconfig/desktop and executes it.

14) Running twm instead of desktop environments like gnome,kde Set the runlevel to 3 in /etc/inittab (In runlevel 5 prefdm is executed which displays gdm ). copy /etc/X11/xinit/xinitrc to ~/.xinitrc and delete the conditionals on the final code block so that only "failsafe settings" gets started.

Delete this file and leave it to /etc/X11/xinit/xinitrc to start everything in order to start the desktop stated in /etc/sysconfig/desktop.

15) using fvwm2 instead of twm

download and install it somewhere lets say ~/fvwm2/ now instead of executing twm in .xinitrc, execute ~/fvwm2/bin/fvwm2.

16) file : find the type of file.

17) find -name : find file whose name follow pattern in the directory tree rooted at

18) change runlevel at runtime  /sbin/sysinit -t  eg sysinit -t 10 5

19) ldd ---> view shared library dependecies.

20) strace ---> Use to execute an executable and see all the system calls made by it.

21) DO NOT PUT KERNEL SOURCE INTO A DIRECTORY WHOSE NAME CONSISTS OF A SPACE.

When at Kunie Hyme
1) Installed debian..

2) Problem shows up...startx does't work startx in debian reads /etc/X11/xf86config-4 or something like that the vdo card setting was wrong. Ran Xf86config or something like that, the native X configurating program. It generated a new file in /etc/X11 called XF86config. Looked at it...the name of the driver was "ati".... So edited XF86config-4 to reflect this and twm worked. voila !!!!

3) all startup scripts are stored insided /etc/init.d/  Which of these are executed during startup depends upon the runlevel. for each runlevel i, there is a directory /etc/rci.d which contains symbolic links to certain scripts inside /etc/init.d/

4) Debian boot process: Kernel --> Init --> reads /etc/inittab . In inittab, it is stated that the first script to be executed is /etc/init.d/rcS...which in turn exectues other scripts in /etc/rcS.d. Then depending upon the runlevel stated in /etc/inittab, the scripts in /etc/rcn.d/ are started.

5) Problems with Xserver. when su-ed from arch119 session....cudn't run xclients.... Xlib: Client is not authorized to connect to Server error.

exectued "xhost +" as root...and worked...it probably lets anybody - any host or any user to use the xserver for display....... one more method is suggested as the use of "xauth" to configure authority.

6) manually renamed the scripts in /etc/rc2.d/ to stop them from running renamed from : Sxxname to _Sxxname

7) Display installed packages : dpkg -l

8) mount cdrom before reading : mount /cdrom

9) removed cdrom from /etc/apt/sources.list and added ftp server of asahi-net. To read more on sources.list see its man page.

10) To display the files installed by a package dpkg -L

11) Xclients couldn't display themselves in local Xserver when ssh-ed to chip.  The problem was in /etc/ssh/ssh_config file (not sshd_config : X forwarding is enabled in chip's sshd_config) . Added a line "ForwardX11 yes" in local file /etc/ssh/ssh_config.

12) Logged in as arch119. su-ed to root but Xclients were not allowed to use the running Xserver. One solution is shown in (5). The other one is to start X once again as root but in a different display as in "startx -- :2" (:2 is the new display number).

13) added S20samba in /etc/rc2.d to start samba and added line to start swat in /etc/inetd.conf ...also added a line to map swat to tcp port 901 in /etc/services..... Workgroup : debian host name: swat can be accessed using http session with :901

Still need to configure

14) Installed webmin ..... start script installed in /etc/init.d/ but not in /etc/rc.d. Connect using https at port 10000 of localhost.Installed various modules for webmin like apache control module, wu-ftpd control module etc.

15) Installed wu-ftpd

16) Installed mysql-server. Configuration files in /etc/mysql/ and databases stored in /var/lib/mysql . One directory for each database. Use GRANT and REVOKE to add/delete, change previleges of users.

17) Installed php4 and configured httpd.conf to load php module.

18) Installed php4-mysql, php4-pear and configured php.ini etc.

19) Installed phpMyadmin to administrate mySql database. Access it using http://localhost/phpmyadmin The phpmyadmin is installed in /usr/share/phpmyadmin . Howerver there is an alias added to it in httpd.conf. No security settings. the login name and pass for phpmyadmin is same as that for mysql. use root/<.....m.>

20) add a user to the system useradd -m

21) Installed tiki in /var/www/tiki......Enabled japanese by editing php.ini [mbstring] settings. [details in php site . search the topic "Multibyte String Functions".

22) Using analog to visualize apache logs.   go to /var/www/ and execute 'analog -O '    view the report in browser http://localhost/.

23) configured httpd.conf so that system documentation can be browsed from  my subnet (22*.25*.23*.160/29) using http:// /doc/ and ~th/shared can be accessed using http:// /th/  . Added "Alias" directive in httpd.conf and added  " "  directive to allow access to the target folders.

24) added a file called analog in "/etc/cron.d" so as to execute analog and create apache stats file in /var/www/analog/ every 30 minutes.

25) 'strace' can be used to see the system calls made by an executable. Can be used to reverse engineer a program <<<< cool.!!!!

26) added one line smbd: ALL except 22*.25*.2**.160/255.255.255.248 to hosts.deny to refuse connections to netbios-ssn from anywhere except my subnet.

27) installed ns-allinone package in arch119 home. all package installed inside ns-allinone-2.28 or something. required to install Xlib-Devel for the packagest to compile. Edited .bashrc to add certain values to $PATH and $LD_LIBRARY_PATH

28) updated debian using sarge release notes. updated kernel as well.  useful programs: aptitude (new debian packet manager)   script (records stdin /stdout)

29) modprobe to load modules....from /lib/modules/`uname -r`.   lsmod, insmod etc 30) Iptables....not built in the kernel....are loaded as modules...    see the tutorials....

31) After the big upgrade from woody to sarge, Xserver stopped working because it replaced the old XF86config-4 file....but I had the old XF86config file created by XF86config....in the XF86config-4 file...changed the device name of graphics card to "ati" and commented out the line with Video RAM size.

32) changed keyboard map to "pc101" and layout ="us"... the backup of current xf86config-4 file is saved as .bak

33) Installed acL utility. Setfacl didnt work in the begining but started working once /etc/fstab was edited so that /dev/hda3 was mounted on /home with acl option on.

34) Installed exim4. The config file is /etc/exim4/exim4.conf.template. But set the parameters of update-exim4.conf.conf using dpkg-reconfigure exim4-config, which will build the exim4 config file (/var/lib/exim4/config.autogenerated)using exim4.conf.template and the newly set parameters. To read more about it see /usr/share/doc/exim4/README.debian

35) Installed awstats. Using it instead of analog. See /etc/crond.d/awstats for its usage.

36) Installed ntop. Should be run as user root as follows: ntop -d -w  -u ntop

37) Setting up guest account in wu-ftpd start wu-ftpd (from inetd) with -a option so that it reads the /etc/wu-ftpd/ftpaccess file.

/var/guestftp is the place where all the guests are chrooted. See the users who are defined as guests in ftpaccess. Also see guest-root and restricted-uid directive.

/var/guestftp should have bin, lib, etc directories. bin for ls command. lib to place the libraries on which ls depend on and /etc should contains minimal versions of /etc/passwd and /etc/group.

in the real passwd file, don't forget to set the shell of guest user as /bin/false or any thing which cant be used as shell but dont forget to add it to /etc/shells otherwise wu-ftpd wont let login.

reference:ebook wu-ftpd and apache security basics

38) Set password for user "root" (arch119 pwd). use mysql -p -u root to login.

39) dpkg-deb -x  --> extract files from a debian package.

40) Installing deb packages locally. ;;;;--> see file ./debianlocalinstall.howto

41) 'nm' -- to check symbols exported by an object file.

42) Basic Authentication in apache - see Apache Basic Authentication tutorial for details. To summarize:

a) add usernames to /etc/apache/passwd using htpasswd	htpasswd /etc/apache/passwd username

b) Edit /etc/apache/httpd.conf to add authorization info in the directories to be protected

c) use group file(/etc/apache/group) to group users.

43) Reformatted the FreeBSD partition (/dev/hda4) with ext2.    mke2fs -b 1024 /dev/hda4

44) added a line in ftpaccess to set the default umask for all groups.    defumask 0422

45) Installed "alien".    To extract all files from a debian package file do something like : alien --to-tgz .deb

46) Changed password for root.

When at CasaVerde
47) Created a script called dhclient in /etc/init.d/ which just calls the dhcp client, dhclient and terminates. Created a symlink in /etc/rc2.d/ which links to this script and called as the first script from /etc/rc2.d/

48) smbd, nmbd are run from inetd, the super daemon, thus smbd can't be seen by ps aux.

49) Installed ntp, ntp-simple . Ntp-simple contains ntpd, the ntp daemon which reads the ntp server, specified in configuration file /etc/ntp.conf and synchronized system time to that of the server. Visit www.pool.ntp.org for a list of ntp servers.

Microsoft Windows
1) Try msconfig.exe : special tool called the "Microsoft System Configuration Utility" or simply "MSCONFIG." Designed to help you troubleshoot problems with your computer, MSCONFIG can also be used to ensure that your computer boots faster and crashes less.

2) How to display "Security" tab in the properties of a folder in NTFS volume. Open Windows Explorer, go to Tools, Folder Options, View and uncheck Use Simple File Sharing.

Enabling TCP/IP Forwarding in Windows XP
1)	In Registry Editor, locate the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

2)	Set the following registry value:

Value Name: IPEnableRouter Value type: REG_DWORD Value Data: 1

A value of 1 enables TCP/IP forwarding for all network connections that are installed and used by this computer.

Batch Resizing of Image Files(with quality specification)
mogrify -resize 800x600 -quality 80 *.jpg

FreeBSD
1) used chpass to change login shells of arch119 and root. changing the info on /etc/passwd won't have any effect....chpass seems to make the changes in /etc/master.passwd which might be the bsd equivalent of password shadow file.

2) added user arch119 to group wheel by editing /etc/group to enable arch119 to execute su.

3) /etc/defaults/rc.conf is the default rc.conf file. It should not be changed...All the changes should be made to /etc/rc.conf. A line "sendmail_enable=NONE" was added to supress sendmail from starting completely. The scripts in /etc/rc.d/are executed in the startup. Most of these scripts get their arguments from the /etc/rc.conf file and decide whether to execute or not.

4) Configures X using xorgconfig. It creates a file in /etc/X11/ which x uses during startup.Important notes about x:       a)keyboard: us101 b)mouse:/dev/psm0       c)monitor:sony,1024X768@70hz,verticalrefreshrate50-70Hz d)graphics card:ati(generic) Problems: Problems arouse with mOUSe because of the moused daemon which seemingly doesnt allow x to open /dev/psm0. Since moused is not useful at all (no need to use mouse in console), turned it off by deleting corresponding lines in /etc/rc.conf.

5) /stand/sysinit :- control panel of FreeBSD.

6) fetch : equivalent of wget.

7) use the pkg* commands to manage freebsd packages.   /var/db/pkg contains info about installed packages.

8) go to /usr/ports/ / / and type "make install clean" to build a package from the sources and install it and and then clean the object files.

9) ctorrent installed.

Changes

 * Added libproc.so to /usr/lib

Networking
route add default gw 192.168.129.1 (test ping ) route del -net default gw 192.168.129.1
 * Using USB to connect to the internet:
 * Enable Internet Connection Sharing for the interface connected to the Internet on the PC.
 * In the zaurus, as root, add the IP address of the PC as default gateway. e.g.. If the IP address of the interface of PC connected to zaurus is 192.168.129.1 then, add the following route in zaurus:
 * To delete this default gateway use:

Links To Resource

 * EmbDebian


 * Guide To Arm-Linux


 * Official Zaurus Developer's Site

Typesetting
Paper size can be changed from a4 to others when converting a dvi file to a pdf file by using the -p option of dvipdfm.
 * Changing paper size: