Thursday, October 29, 2009

Let non-root user can reboot linux box

There are one command called sudo could allow normal linux user execute root command. The configuration file or sudo command is /etc/sudoers and the configuration file should only be modified by using visudo command. For example we creat a group called shutdown. Following line will allow all shutdown group user can use sudo shutdown the linux box.

%shutdown ALL=(root) NOPASSWD: /sbin/reboot
%shutdown ALL=(root) NOPASSWD: /sbin/halt
%shutdown ALL=(root) NOPASSWD: /sbin/shutdown

usermod command can add user to other group.

Options:

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

Example: To add the group 'others' to the user roger

usermod -Gothers roger

chgrp, chown command can change the group. chgrp can be used by normal user

*

chgrp group target1

* chown [-R] newowner filenames


Example:Give permissions as owner to user test.
chown test files.log

Clean up SQL database use command line tools

There are some SQL server command line tools are installed in C:\Program Files\Microsoft SQL Server\80\Tools\Binn folder. OSQL.exe can connect to the database and execute SQL query on it.

The usage of OSQL.exe is
OSQL /u username
system will pop up for password, after authentication. we can type in SQL query and execute them on the server.
for example

To release unused database space:
DBCC SHRINKDATABASE (local, 80 TRUNCATEONLY)
GO

To find a database name:
select db_name(0) [0 is the database index number]
Go

Sunday, October 11, 2009

Juniper Router Interface Naming:


Juniper router interface naming based on model:

  • “media type-FPC number/PIC number/port number” It commonly knows as MM-F/P/T model for M series router.

  • “media type-PIM slot number/virtual PIM number/port number, It commonly knows as MM-F/P/T for J series router. Fixed interface use PIM slot number 0.



FPC - Flexible PIC Concentrator which contain several PIC slots (on M series)

PIC – Physical Interface Card

PIM – Physical Interface Module (on J series) Each PIM contains a network processor that handles some of the packet processing functions.



  • at: ADSL interface;

  • dsc: Virtual interface that discards packets;

  • fxp0: This is an Out of Band (OOB) management Ethernet interface. It is connected to the router's Routing Engine (RE) and can be used for Out of Band management access to the router. It can also be used to send management messages such as syslog or Simple Network Management Protocol (SNMP) traps. This interface is a nontransit interface, which means that traffic cannot enter this interface and exit via a LAN/WAN interface, nor can it enter a LAN/WAN interface and exit through the management interface.

  • fxp1: This is an internal Fast Ethernet or Gigabit Ethernet (depending on the model of router) interface between the RE and the Packet Forwarding Engine (PFE). This interface is never configured but can be helpful when troubleshooting router issues. It is only in application-specific integrated circuit (ASIC) platforms (M/T-series) and not in the virtualized PFE J-series platforms.

  • e1: E1 WAN interface;

  • fe: Fast Ethernet(10/100) LAN interface;

  • ge: Gigabit Ethernet (10/100/1000) LAN interface;

  • gr,gre: Generic touting encapsulation (GRE) interface for tunnel services-this interface is internally generated and not configurable;

  • ip, ipip: IP-over-IP interface-this interface is internally generated and not configurable;

  • ls, lsi: link services interface- this interface is internally generated and not configurable;

  • mt, mtun: Muticast GRE interface-this interface is internally generated and not configurable;

  • pd, pimd: Protocol Independent Multicast(PIM) de-encapsulator interface-this interface is internally generated and not configurable;

  • pe, pime: PIM encapsulator interface-this interface is internally generated and not configurable;

  • pp: Point-to-point Protocol(PPP) interface-used for PPP over Ethernet (PPPoE);

  • se: Serial interface(include EIA230, RS232, RS449, V.35 and X.21 interfaces);

  • sp: Services interface;

  • tap: The tap interface is internally generated and not configurable;

  • t1: T1 (also called DS1) WAN interface;

  • t3: T3 (also called DS3) WAN interface;