Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, September 3, 2014

myCloud - configure ssh access for non-root users

From a post in a forum:

- Enable ssh:
http://<mybooklive>/UI/ssh


- Create shares, users, set passwords and permissions via dashboard

- Allow Users to SSH:
edit file /etc/ssh/sshd_config
Change "AllowUsers" line by adding user names such as:
AllowUsers root user1 user2


- Optional: Set users home dir: edit file /etc/passwd
The following will set home dir to "Public"
Change from "/shares:/bin/sh" to "/shares/Public:/bin/sh"


- Restart ssh deamon or reboot:
/etc/init.d/ssh restart


Test ssh for your users within the home network. If all works, then proceed to:
- Set your router to forward port TCP 22
- Set DDNS on your router

Saturday, May 24, 2014

Adding NFS entry to myCloud

Mounting an nfs volume on my Ubuntu VM (where I am running ownCloud) to access data on myCloud:

mkdir  /shared

mount yourMyCloudIP:/nfs /shared

emacs etc/fstab

add these lines at the end of fstab file:

#Entry for MyCloud NFS
yourMyCloudIP:/nfs /shared nfs default 0 0

save and exit editor.

Friday, May 16, 2014

Installing packages on myCloud

I really like my new WD myCloud and all that it can do.  But I really don't like the fact that emacs was not included on the base Debian OS.

So, the question is, how to install a new package on Debian.  Here is an example of getting emacs installed on the myCloud.  

First connect with ssh as root.

> apt-get update 
> apt-get install emacs

The first command updates the list of packages the system knows about.  The list is defined by the list of source in the file /etc/apt/sources.list.

vi cheat-sheet

As much as a loath the vi editor (clearly emacs is FAR superior), here is a decent cheat-sheet to cover the basics:

http://www.atmos.albany.edu/daes/atmclasses/atm350/vi_cheat_sheet.pdf

Thursday, September 26, 2013

Adding RHEL6 installation DVD as yum repository

In building a RHEL6 VM (VMware Workstation), I wanted to define the install DVD ISO as a yum repository.


  • Mount the ISO through workstation as a DVD
  • Verify your path to the disk.  Easiest way... try right-clicking on the DVD desktop icon and select "Open in Terminal".  Use pwd to see the path.
  • Create the file /etc/yum.repos.d/dvd.repo
      [RHEL6-DVD-Server] 
      mediaid=xxxxxxxxxx.xxxxxx
      name=RHEL6 DVD Server
      baseurl=file:///media/RHEL_6.0\ x86_64\ Disc\ 1/Server
      enabled=1
      gpgcheck=1

  • Replace xxxxxxxxxx.xxxxxx with number in /path/to/DVD/.discinfo
      # cat /media/RHEL_6.0\ x86_64\ Disc\ 1/.discinfo
      1285193176.460470
      Red Hat Enterprise Linux 6.0
      x86_64
      1
  • rpm --import /path/to/DVD/RPM-GPG-KEY-redhat-release
      rpm --import /media/RHEL_6.0\ x86_64\ Disc\ 1/RPM-GPG-KEY-redhat-release

At this point, the yum repository should be visible and ready to use.  Try the following commands to confirm:
  • yum repolist
  • yum grouplist

Wednesday, September 25, 2013

Building a new RHEL6 VM using kickstart

There are main things I need here:

  1. A new VM -  Pretty easy, just use workstation and create a new VM without installing the OS.  
  2. The RHEL6 install disk - Mount the RHEL6 install disk ISO in the new VM.  
  3. The kickstart file - this is the tricky part.  Two things are critical here... a) the kickstart cfg file needs to be accessible to the new VM, and b) the kickstart cfg file needs to define where to get the install bit. 
To address the first issue (a), the simplest way to tackle this is to create a kickstart cfg file and make it available locally on the network via http.  I did this by bringing up a second VM and simply using a local httpd and copying the ks.cfg into the htdocs directory.

To address the second issue (b), the kickstart file needs to point the installer to the repo (or DVD) with the RHEL6 install bits.  As mentioned above in point 2, the disk was already made available through the virtual DVD (it could also be made available through the httpd that is being used for the ks.cfg file).  But just because the ISO is available doesn't mean that kickstart knows to use it.  So, if the following line is part of the ks.cfg file, kickstart will look to the local booted source as the DVD.

    #repo --name="Red Hat Enterprise Linux"  --baseurl=file:///mnt/source --cost=100

You are now ready to start the kickstart process.

  • Boot the new VM (off of the DVD ISO - use F2 to set the boot order)
  • On the screen where you are given a choice of where to boot from or where to install from, accept the first option "Install or upgrade an existing system" and hit TAB to edit the options
  • Add the following to the end of the existing line (vmlinuz initrd=initrd.img is already there):
    • vmlinuz initrd=initrd.img ks=http://<httpd-ip-addr>/ks.cfg
  • Hit enter to continue.
  • Accept whatever else the wizard offers you
    • Use All Space or Replace Existing Linux

Saturday, September 21, 2013

Avoid emacs split window at startup

If the variable inhibit-startup-screen is non-nil, Emacs does not display the startup screen.

Set the setting in your .emacs file. 

(setq inhibit-startup-screen t)

Thursday, August 8, 2013

mv numerous files at once



Or...

   for file in * ; do mv $file `echo $file | sed -e 's/AAA-\(.*\)_\(.*\).txt/AAA-\2-\1.txt/'`; done 

(for help understanding... http://www.daemonforums.org/showthread.php?t=2565)

Thursday, May 16, 2013

Symlinks on Windows

Looks like Windows (7 at least) supports symlinks... finally!!  Yay.


    C:\>mklink
    Creates a symbolic link.

    MKLINK [[/D] | [/H] | [/J]] Link Target

            /D      Creates a directory symbolic link.  Default is a file
                    symbolic link.
            /H      Creates a hard link instead of a symbolic link.
            /J      Creates a Directory Junction.
            Link    specifies the new symbolic link name.
            Target  specifies the path (relative or absolute) that the new link
                    refers to.

Example


    C:\>mklink /D my-link h:\usr\htdocs
    symbolic link created for my-link <<===>> h:\usr\htdocs

    C:\>






Tuesday, May 14, 2013

Find with grep


Need to search a directory tree for files containing a string?  Easy enough with a single file... just use "grep".  Easy enough with all the files in a directory... again, just use grep.


But, if you need to search a whole tree structure... use find, with xargs and grep:

    find . -name *.sh | xargs grep while

This search all files with a .sh extension starting in the current directory for the keyword while

To delete everything in all .svn directories:

    find . -name .svn -print0 | xargs -0 rm -rf

Reinitializing partition tables

Reinitializing partition tables

Had an interesting problem... trying to install Windows 7 on an old XP machine that had RAID turned on.  Tried to disable the BIOS level RAID, and do a new install.

The Windows 7 installation failed because a couple of reasons.  At first it could not see the disks.  After fiddling with the BIOS settings, the installer saw 2 out of 3 disks, but could not install to them.  It complained that the version of NTFS was unsupported.  I suspected that the drives had left over stuff from the RAID configuration.

Recommendation from a friend was to nuke the partition table and start from scratch.  Did this by booting off of a Fedora Live DVD, bringing up a terminal window and using dd to overwrite the start of the disks:

    dd if=/dev/zero of=/dev/sda bs=63k count=100
    dd if=/dev/zero of=/dev/sdb bs=63k count=100
    dd if=/dev/zero of=/dev/sdc bs=63k count=100

Success!