Linux for Windows Server Administrators

Linux for Windows Server Admins

Create and Add Users

Add the user by typing in useradd followed by the desired login name to create. An example would be useradd sburns. This will follow with a few questions to answer and finally create the user. You should now be able to login with PuTTY.  Once logged in as the nonprivileged user, the administrator can elevate their privileges to root.

Using su – will allow a user to switch between users, even root, as long as the user knows the relevant password. The command itself is shorthand for “switch user.” As root an administrator can change to any other user by using the command su simon (or su bill or whomever), assuming the password is known. The “-” switch is used to give all the environmental variables. Using su – without specifying a user will assume you want to switch to the root user. There is a file called /etc/sudoers that holds the configuration for su.

So now we are logged in, lets cover some rudimentary file system-related items. When logged in as a normal user, they would initially be placed in their home directory that was created when the user was created, as was shown before. Move about the system using the command cd, the same as Windows, but remember that Linux is case sensitive.

Using the Linux CLI

With Linux, the backslash becomes a forward slash. To return to your own home directory at any point, just type cd without any arguments. If you are also not sure where you are in the file structure, there is a command called pwd. This command will give the full path to your current location. This is a very useful command, especially if you have many windows open – and double check before using potentially dangerous commands!

Managing Drives with Linux

Linux has no concept of drive letter mappings. Instead drive letters map to what are known as mount points. A very rudimentary example is with CD ROM drives. In Windows, when a CD is inserted, it is mounted as a drive letter. For example, E: This differs in Linux because when you mount a CD, it essentially links the contents of a CD to a folder. Something to bear in mind is that as a rule Linux machines do not auto mount media.

An administrator would have to mount the CD and link it to a folder. Most modern Linux distributions come with a media folder for this purpose. To mount a CD, use the commandmount /dev/cdrom /media. Similarly, to dismount a disk, use the command umount /media. This mounting method is not only for CDs but also for USB sticks, hard disks, and most other media, albeit with some occasional options to specify file systems and such.

To see what is mounted currently, type the command mount. Standard mounts are stored in the file /etc/fstsab. You can modify this file to add additional mount points if you wanted to add additional storage systems at boot. Pro tips: First, make sure you have a backup (use the command cp /etc/fstab fstab.bak). Second, use the mount -a command to verify the fstab file is still valid before you reboot it and find that it isn’t!

Now it might be a good time to introduce you to how most Linux installations are organized from a file and directory perspective.

  • / – root, as in the top level of the disk
  • /home – where users home directories and personal data are located
  • /boot – contains important boot files. You will rarely need to go in here
  • /dev – contains pseudo devices that link directly to the hardware
  • /root – the roots home directory, and where a root can store its files
  • /etc – contains all the configuration files for pretty much everything: networking, services, and some applications
  • /mount – This folder is used to mount NFS mounts and removable media
  • /var – Contains many system components, logs, and miscellaneous
  • /proc – Holds information about running processes.
  • /bin – Contains program files
  • /sbin – Contains system administration binary files

Useful Linux CLI Commands

When working with files, there are some useful commands you can run to help you manage them, as Linux doesn’t tend to do file extensions. If you want to know what type of file you are looking at, you can use the command file file, and it will interrogate the file and provide all the information it can gather.

To view human readable files, you can use the cat command. To edit a file, use the nano editor (for example, nano filename).

If you need to find a file, you can use the locate command. For example, to locate redhat-release (This file holds the release information for the RedHat Build) use the command locate redhat-release.

Other useful commands we can use right now are df, which gives disk space statistics. Usingdf -h may prove a better option as it gives sizes in human readable form of megabytes, gigabytes, and such, rather than an unwieldy size in bytes.

If you want to change your password now, you can use the command passwd. Used without any switches, it will allow you to change the password of the user you are logged in as. If you are logged in as root, you can change other people’s passwords by using the passwdcommand, followed by the username. An example would be passwd stuart.

It is also possible to edit the user setup by use of the command usermod. This will allow you to manage and modify settings on a per-user basis; for example, changing the username or home directory.

via Linux for Windows Server Administrators.

 

 

How to enable Shadow Copy on a shared folder in Windows Server 2012 R2

What Is a Shadow Copy?

shadow copy of a disk volume or shared folder is a snapshot of changes made to files at a given point in time. Snapshots are taken at set intervals, allowing users to restore to a previous version of a file without having to ask IT to restore the file from a backup.

Configure Shadow Copies for a File Share in Windows Server 2012 R2

To configure shadow copies in Windows Server 2012 R2, log on to your file server with a local administrator account and follow the instructions:

  • Switch to the server desktop and open File Explorer by using the icon on the desktop taskbar or by pressing WINDOWS + E.
  • In File Explorer, right-click the volume where the share is located and select Properties from the menu.
  • In the Properties dialog, switch to the Shadow Copies tab.
  • Under Select a volume:, select the volume where you want to turn on shadow copies from the list, and then click Enableshadow1
  • In the Enable Shadow Copies dialog, click Yes to complete the procedure, noting the warning about file servers with high I/O loads.
  • In the Properties dialog, you will see that shadow copies are now enabled for the volume, and when the next snapshot is scheduled to be taken.

Optionally, you can click Create Now to have a snapshot created immediately. There are also options to delete and revert to a previous shadow copy.

  • Now click Settings in the Properties dialog.
  • In the Settings dialog, you can view information about where the shadow copies are located and change the reserved disk space available to the Volume Shadow Service (VSS).
  • The default schedule takes two snapshots daily: Monday to Friday. If you want to change these settings, click Schedule and add or remove scheduled tasks as required.
  • Click OK in the Settings dialog, and again in the Properties dialog to complete the configuration.

Restore Files Using Previous Versions

Windows 7 (and later) clients support restoring from file shares where shadow copies are enabled.

  • From a supported client, or locally from Windows Server, right-click the file you want to revert and select Properties from the menu.
  • In the Properties dialog, switch to the Previous Versions tab.
  • If there is a copy of the file available to restore, it will be displayed in the list, with the time and date of the copy.
  • Select a previous version of your file from the list. shadow2
  • Now you can decide to restore, open, or copy the file as appropriate and follow the instructions.
  • Close the Properties dialog when you’re done.

via How to enable Shadow Copy on a shared folder in Windows Server 2012 R2.