Here is quick tip, if you wish to perform an unattended download of large files such as Linux DVD ISO use wget as follows: wget -bqc http://path.com/url.iso Where, => -b : Go to background immediately after startup. If no output file is specified via the -o, output is redirected to wget-log. => -q : Turn off Wget's output aka save disk space. => -c : Resume broken download i.e. continue getting a partially-downloaded file. This is useful when you want to finish up a download started by a previous instance of Wget, or by another program. This tip will save your time while downloading large ISO image from the internet.
Recovering Ubuntu after Windows wipes Grub2 boot loader
The below blog makes possible to install XP after Ubuntu linux.First installl XP normally in empty drive. Windows wipes MBR of Ubuntu and boot loader Grub.You just need ubuntu live CD Karmic Koala 9.10 or above Recover Grub 2 via LiveCD $ sudo fdisk -l - Now, you need to remember which device listed is your linux distribution, for reference, /dev/sda1 will be used. Now we need to mount the filesystem to /mnt
$ sudo mount /dev/sda1 /mnt - If you have /boot on a separate partition, that need's to be mounted aswell. For reference, /dev/sda2 will be used.
$ sudo mount /dev/sda2 /mnt/boot Make sure you don't mix these up, pay attention to the output of FDISK - Now mount the rest of your devices and some other things needed in the chroot
$ sudo mount --bind /dev /mnt/dev $ sudo mount --bind /proc /mnt/proc $ sudo mount --bind /sys /mnt/sys - Now chroot into your system
$ sudo chroot /mnt You should be chroot'd into your system as root, you can now run commands as root, without the need for sudo. $ nano /etc/default/grub $ update-grub $ grub-install /dev/sda $ grub-install --recheck /dev/sda - Press Ctrl+D to exit out of the chroot.
- Once you exit back to your regular console, undo all the mounting, first the /dev and others
$ sudo umount /mnt/dev $ sudo umount /mnt/sys $ sudo umount /mnt/proc - Now you can unmount the root system. (But if you have a separate boot partition which you mounted earlier, you have to unmount this first, or you will get a "device busy" error message.)
$ sudo umount /mnt - And you should be free to restart your system right into GRUB 2 and then into your system installation.
If you had alternate OS entries, update-grub might say "Cannot find list of partitions!". Ignore it and continue - once you can boot into your linux installation, do so and then rerun update-grub and grub-install /dev/sda as root.
Step 1: Disconnect network folders In Run type net use * /d It disconnects all the network shares Step 2: In Run type control userpasswords2 in the next window go to the second tab on top, named: Advanced and from there open: Manage Passwords There you should see if there is a password stored for the address that you have mentioned If yes then delete it and close the windows with OK try to connect again to that address, it should prompt for authentication. Do not check the Remember option... A short cut to this stepstart >run > rundll32.exe keymgr.dll, KRShowKeyMgr and delete saved password
How to set samba to allow read-only file sharing for your LAN computers as guest ? (without be prompted for a password).Because users won't be prompted for a user/password, this is meant to be installed in a LAN where all host are to be trusted. Smoothen samba default security by changing the security variable: security and make sure it is set to share instead of user and that guest account is enabled
open and edit /etc/samba/smb.confsecurity = share ... ... guest account = nobody
Now, we can create a share to be accessible to guest users: [Guest Share] comment = Guest access share path = /path/to/dir/to/share browseable = yes read only = yes guest ok = yes
You can now test that your configuration is good using testparm: $ testparm If everything is fine, it is time to reload samba service to have your new configuration taken into account: $sudo /etc/init.d/samba reload That's it, anybody in your LAN can now access your share.
Just use below command NBTSTAT -A IPADDRESS
shows mac address and hostname More about Nbtstat Nbtstat is designed to help troubleshoot NetBIOS name resolution problems. When a network is functioning normally, NetBIOS over TCP/IP (NetBT) resolves NetBIOS names to IP addresses. It does this through several options for NetBIOS name resolution, including local cache lookup, WINS server query, broadcast, LMHOSTS lookup, Hosts lookup, and DNS server query. The nbtstat command removes and corrects preloaded entries using a number of case-sensitive switches. The nbtstat - a < name > command performs a NetBIOS adapter status command on the computer name specified by < name> . The adapter status command returns the local NetBIOS name table for that computer as well as the MAC address of the adapter card. The nbtstat -A < IP address > command performs the same function using a target IP address rather than a name. The nbtstat - c option shows the contents of the NetBIOS name cache, which contains NetBIOS name-to-IP address mappings. nbtstat -n displays the names that have been registered locally on the system by NetBIOS applications such as the server and redirector. The nbtstat -r command displays the count of all NetBIOS names resolved by broadcast and by querying a WINS server. The nbtstat -R command purges the name cache and reloads all #PRE entries from the LMHOSTS file. #PRE entries are the LMHOSTS name entries that are preloaded into the cache. For more information about the LMHOSTS file, see the appendix "LMHOSTS Files" in this book. Nbtstat -RR sends name release packets to the WINS server and starts a refresh, thus re-registering all names with the name server without having to reboot. This is a new option in Windows NT 4.0 with Service Pack 4 as well as in Windows 2000. You can use nbtstat -S to list the current NetBIOS sessions and their status, including statistics. Sample output looks like this: C:\>nbtstat -S Local Area Connection: Node IpAddress: [172.16.0.142] Scope Id: [] NetBIOS Connection Table Local Name State In/Out Remote Host Input Output ------------------------------------------------------------------ TESTPC1 <00> Connected Out 172.16.210.25 6MB 5MB TESTPC1 <00> Connected Out 172.16.3.1 108KB 116KB TESTPC1 <00> Connected Out 172.16.3.20 299KB 19KB TESTPC1 <00> Connected Out 172.16.3.4 324KB 19KB TESTPC1 <03> Listening Finally, nbtstat -s provides a similar set of session listings, but provides the remote computer names, rather than their IP addresses. Note The options for the Nbtstat command are case sensitive. The Nbtstat switches are listed in Table 3.4. Table 3.4 Nbtstat Switches | Switch | Name | Function | | -a < name > | adapter status | Returns the NetBIOS name table and MAC address of the address card for the computer name specified. | | -A < IP address > | Adapter status | Lists the same information as -a when given the target's IP address. | | -c | cache | Lists the contents of the NetBIOS name cache. | | [ Number ] | Interval | Typing a numerical value tells Nbtstat to redisplay selected statistics each interval seconds, pausing between each display. Press Ctrl+C to stop redisplaying statistics. | | -n | names | Displays the names registered locally by NetBIOS applications such as the server and redirector. | | -r | resolved | Displays a count of all names resolved by broadcast or WINS server. | | -R | Reload | Purges the name cache and reloads all #PRE entries from LMHOSTS. | | -RR | ReleaseRefresh | Releases and reregisters all names with the name server. | | -s | sessions | Lists the NetBIOS sessions table converting destination IP addresses to computer NetBIOS names. | | -S | Sessions | Lists the current NetBIOS sessions and their status, with the IP address. | | /? | Help | Displays this list. |
To change the user's home directory, just use the 'usermod' command, which exists on all unices. It works like this: usermod -d /path/to/new/homedir/ username
How to add a user to the sudoers list? Beleive it or not, this is a fairly common question and in all reality the answer is quite simple. Adding a user to the sudoers list on a fully installed Linux system such as Debian is only possible via the command visudo. Users in the sudoers list are allowed the privileges to run commands and open files as the root user. In the following quick tutorial, we will show you how adding a new sudoer is quickly done. How to add a user to the sudoers list: - Open a Root Terminal and type visudo (to access and edit the list)
- Using the up/down arrows, navigate to the bottom of the sudoers file that is now displayed in the terminal
- Just under the line that looks like the following:
root ALL=(ALL) ALL
- Add the following (replacing user with your actual username):
user ALL=(ALL) ALL
- Now press Ctrl+X and press Y when promted to save
That's it, your new user now has root privileges! Example Sudoers Screenshot: 
-
Save and close all open applications. -
Use the Ctrl-Alt-Backspace shortcut keys to restart GNOME. -
If Ctrl-Alt-Backspace is disabled, type sudo /etc/init.d/gdm restart
Starting programs automatically at startup in Gnome  There are some applications we always start as soon as we log into our Linux, as Firefox or our news reader. If you want you can ask Linux to start these programs for you as soon as you log in, to do this just go to: System->Preferences->Sessions in you Gnome menu.  Now click on Add, and fill in the fields the appropriate info, so you can start you new application.  Put in name the name of the application, in command the command you need to start that applications (better if you use the complete path) you can use the command which to know where an application is. in this case I used which firefox Then fill in comment anything that will describe to you, what that command is going to do. You can start as many applications as you want, but of course this will slow down your Linux boot up.
/etc/network/interfaces file contains network interface configuration information for the both Ubuntu and Debian Linux. This is where you configure how your system is connected to the network. Defining physical interfaces such as eth0 Lines beginning with the word "auto" are used to identify the physical interfaces to be brought up when ifup is run with the -a option. (This option is used by the system boot scripts.) Physical interface names should follow the word "auto" on the same line. There can be multiple "auto" stanzas. ifup brings the named inter faces up in the order listed. For example following example setup eth0 (first network interface card) with 192.168.1.5 IP address and gateway (router) to 192.168.1.254: iface eth0 inet static address 192.168.1.5 netmask 255.255.255.0 gateway 192.168.1.254 Setup interface to dhcp To setup eth0 to dhcp, enter: auto eth0 iface eth0 inet dhcp Assigining Multiple IP address in Debian Edit the file that Fedora places the interface info in, in Debian it's located in /etc/networking/interfaces.
auto eth0 iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.1 auto eth0:0 iface eth0:0 inet static <---next interface in eth0 address 192.168.10.21 <--- can not be the same as any other IP netmask 255.255.255.0 gateway 192.168.10.1Following is file located at /usr/share/doc/ifupdown/examples/network-interfaces, use this file as reference (don't forget interfaces man pages for more help): ###################################################################### # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # # A "#" character in the very first column makes the rest of the line # be ignored. Blank lines are ignored. Lines may be indented freely. # A "\" character at the very end of the line indicates the next line # should be treated as a continuation of the current one. # # The "pre-up", "up", "down" and "post-down" options are valid for all # interfaces, and may be specified multiple times. All other options # may only be specified once. # # See the interfaces(5) manpage for information on what options are # available. ######################################################################
# We always want the loopback interface. # # auto lo # iface lo inet loopback
# An example ethernet card setup: (broadcast and gateway are optional) # # auto eth0 # iface eth0 inet static # address 192.168.0.42 # network 192.168.0.0 # netmask 255.255.255.0 # broadcast 192.168.0.255 # gateway 192.168.0.1
# A more complicated ethernet setup, with a less common netmask, and a downright # weird broadcast address: (the "up" lines are executed verbatim when the # interface is brought up, the "down" lines when it's brought down) # # auto eth0 # iface eth0 inet static # address 192.168.1.42 # network 192.168.1.0 # netmask 255.255.255.128 # broadcast 192.168.1.0 # up route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2 # up route add default gw 192.168.1.200 # down route del default gw 192.168.1.200 # down route del -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2 # A more complicated ethernet setup with a single ethernet card with # two interfaces. # Note: This happens to work since ifconfig handles it that way, not because # ifup/down handles the ':' any differently. # Warning: There is a known bug if you do this, since the state will not # be properly defined if you try to 'ifdown eth0' when both interfaces # are up. The ifconfig program will not remove eth0 but it will be # removed from the interfaces state so you will see it up until you execute: # 'ifdown eth0:1 ; ifup eth0; ifdown eth0' # BTW, this is "bug" #193679 (it's not really a bug, it's more of a # limitation) # # auto eth0 eth0:1 # iface eth0 inet static # address 192.168.0.100 # network 192.168.0.0 # netmask 255.255.255.0 # broadcast 192.168.0.255 # gateway 192.168.0.1 # iface eth0:1 inet static # address 192.168.0.200 # network 192.168.0.0 # netmask 255.255.255.0
# "pre-up" and "post-down" commands are also available. In addition, the # exit status of these commands are checked, and if any fail, configuration # (or deconfiguration) is aborted. So: # # auto eth0 # iface eth0 inet dhcp # pre-up [ -f /etc/network/local-network-ok ] # # will allow you to only have eth0 brought up when the file # /etc/network/local-network-ok exists.
# Two ethernet interfaces, one connected to a trusted LAN, the other to # the untrusted Internet. If their MAC addresses get swapped (because an # updated kernel uses a different order when probing for network cards, # say), then they don't get brought up at all. # # auto eth0 eth1 # iface eth0 inet static # address 192.168.42.1 # netmask 255.255.255.0 # pre-up /path/to/check-mac-address.sh eth0 11:22:33:44:55:66 # pre-up /usr/local/sbin/enable-masq # iface eth1 inet dhcp # pre-up /path/to/check-mac-address.sh eth1 AA:BB:CC:DD:EE:FF # pre-up /usr/local/sbin/firewall # Two ethernet interfaces, one connected to a trusted LAN, the other to # the untrusted Internet, identified by MAC address rather than interface # name: # # auto eth0 eth1 # mapping eth0 eth1 # script /path/to/get-mac-address.sh # map 11:22:33:44:55:66 lan # map AA:BB:CC:DD:EE:FF internet # iface lan inet static # address 192.168.42.1 # netmask 255.255.255.0 # pre-up /usr/local/sbin/enable-masq $IFACE # iface internet inet dhcp # pre-up /usr/local/sbin/firewall $IFACE
# A PCMCIA interface for a laptop that is used in different locations: # (note the lack of an "auto" line for any of these) # # mapping eth0 # script /path/to/pcmcia-compat.sh # map home,*,*,* home # map work,*,*,00:11:22:33:44:55 work-wireless # map work,*,*,01:12:23:34:45:50 work-static # # iface home inet dhcp # iface work-wireless bootp # iface work-static static # address 10.15.43.23 # netmask 255.255.255.0 # gateway 10.15.43.1 # # Note, this won't work unless you specifically change the file # /etc/pcmcia/network to look more like: # # if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi # get_info $DEVICE # case "$ACTION" in # 'start') # /sbin/ifup $DEVICE # ;; # 'stop') # /sbin/ifdown $DEVICE # ;; # esac # exit 0
# An alternate way of doing the same thing: (in this case identifying # where the laptop is is done by configuring the interface as various # options, and seeing if a computer that is known to be on each particular # network will respond to pings. The various numbers here need to be chosen # with a great deal of care.) # # mapping eth0 # script /path/to/ping-places.sh # map 192.168.42.254/24 192.168.42.1 home # map 10.15.43.254/24 10.15.43.1 work-wireless # map 10.15.43.23/24 10.15.43.1 work-static # # iface home inet dhcp # iface work-wireless bootp # iface work-static static # address 10.15.43.23 # netmask 255.255.255.0 # gateway 10.15.43.1 # # Note that the ping-places script requires the iproute package installed, # and the same changes to /etc/pcmcia/network are required for this as for # the previous example.
# Set up an interface to read all the traffic on the network. This # configuration can be useful to setup Network Intrusion Detection # sensors in 'stealth'-type configuration. This prevents the NIDS # system to be a direct target in a hostile network since they have # no IP address on the network. Notice, however, that there have been # known bugs over time in sensors part of NIDS (for example see # DSA-297 related to Snort) and remote buffer overflows might even be # triggered by network packet processing. # # auto eth0 # iface eth0 inet manual # up ifconfig $IFACE 0.0.0.0 up # up ip link set $IFACE promisc on # down ip link set $IFACE promisc off # down ifconfig $IFACE down # Set up an interface which will not be allocated an IP address by # ifupdown but will be configured through external programs. This # can be useful to setup interfaces configured through other programs, # like, for example, PPPOE scripts. # # auto eth0 # iface eth0 inet manual # up ifconfig $IFACE 0.0.0.0 up # up /usr/local/bin/myconfigscript # down ifconfig $IFACE down
|