Showing posts with label Command Line. Show all posts
Showing posts with label Command Line. Show all posts

Tuesday, February 17, 2015

Temporarily disabling password complexity on hardened CentOS 6.5


Navigate to etc/pam.d
(system-auth is symbolic link to system-auth-ac)

Rename original file:
"mv system-auth-ac system-auth-ac-backup"

Create a new file
"cp system-auth-ac-backup system-auth-ac"

Edit "system-auth-ac"
Look for line that starts with "password required pam_cracklib.so"
Change parameters "minlen=1", "dcredit=0", "ucredit=0", "ocredit=0", "lcredit=0"
Save the file (No reboot is required)
Change password with "passwd"

Revert original file:
"cp system-auth-ac-backup system-auth-ac"

Remove bash history
make sure you're in your "profile" directory
"rm .bash_history" - you will be prompted if you want to delete the file.

Wednesday, April 11, 2012

How to enable local administrator in Windows 7 using command line / scripting

1. Go to your Start menu and in “Accessories” list, open “Command Prompt” by right-clicking on its icon and choosing “Run as Administrator”
2. When the Command Prompt window appears, enter the command net user administrator /active:yes
3. When done, log out from your current account.
4. The Administrator account should now be present on your log in screen.

To turn the build in administrator account off, do the same except the command will be
net user administrator /active:no

Tuesday, March 27, 2012

HOWTO: Shortcuts to managing DHCP in enterprise environments

How to extract MAC address from DHCP reservations


netsh dhcp server dump >> reservationdump.txt
find “Add reservedip” reservationdump.txt >> reservations.csv


Updated June 26, 2012


Had another issue at work where I had to merge two DHCP scopes that divided a single segment between the scopes. Each scope controlled a range of IP addresses (Scope #1, .1 - .127, Scope #2, .128 - 254). 


Both of the scopes had custom scope attributes defined. 


One of the scopes had reservations defined.


To make matters more interesting, the subnet mask had to be changed from /25 (255.255.255.128) to /24 (255.255.255.0) - DHCP scope allows you to edit the defined range but the subnet mask is greyed out.


Lastly, a new scope had to be created under a new segment based on one of the old scopes above.




How to merge scopes without losing custom settings and re-doing reservations:


A variation of the commands  at the start of this post will get you a text dump.
(Note there are two kinds of export data; binary and text and they are not interchangable)


If you need to quickly modify a scope on DHCP, eg, delete a scope and recreate all the reservations in a new scope, the above technique with the following steps will make it easier.


1. Export the scopes: netsh dhcp server dump >> dump.txt
2. Edit the exported file (you can safely delete the other non applicable scopes)
3. Import the exported file using this command: netsh exec c:\dump.txt


You may encounter these errors when you try to export DHCP server configuration (binary):
"An attempt was made to load a program with an incorrect format" - Hotfix solution from Microsoft
"Access denied" error message when you use the "netsh dhcp server import" - Binary Export/Import DHCP database steps




References:
Netsh commands for DHCP


Starting point for solution:
HOWTO: Import and Export DHCP reservations in server 2003