Showing posts with label OpenSUSE. Show all posts
Showing posts with label OpenSUSE. Show all posts

how to lock a directory by using shell scripts in openSUSE

In this tip, I want to demonstrate how to write a shell script to lock a folder on openSUSE desktop. Now suppose that there are many folders on your Desktop and you want to lock down only one or some folders to keep from unwanted user change. This means that user can move, view ,or delete your folder (the locked folder) when they are being on Desktop, but those folder will be back on Desktop again when the computer is restarted.

I think the above idea is similar to DeepFreeze or KioskTool concept. but DeepFreeze or KioskTool will lock the whole system or Desktop environment, your can not specify the folder.

Here are the basic steps to do the work as what I described above:
1. Download file install.sh to somewhere in your computer
2. Go to Konsole and log in as root
3. Go to the location of install.sh then run command ./install
4. Input folder name that you want to lock then you are done

Here is detail of install.sh file:

#!/bin/bash
#input folder name, suppose that folder is located in desktop
  finputbox()
  {
  dialog --title "Inputbox - To take input from you" --backtitle "Linux Shell\
Script Tutorial" --inputbox "Enter folder name on Desktop please" 8 60 2>/tmp/input.$$
  sel=$?
  na=`cat /tmp/input.$$`
  case $sel in
        0) echo "Folder name is $na" ;;
        1) echo "Cancel is Press" ;;
        255) echo "[ESCAPE] key pressed" ;;
  esac
  checkdir="/home/$USER/Desktop/$na"
  if [ -d "$checkdir" ]
  then
        num=1
  else
        num=2
  fi
  }
  #check folder is exist?
  num=2
  echo $num
  while [ $num -eq 2 ]
  do
        finputbox
  done

#create backup file

  touch /home/backup.sh
  chmod 777 /home/backup.sh
  cd /home
  echo "#!/bin/bash" > backup.sh
  echo "rm -f /root/bakcup_file.tar" >> backup.sh
  echo "tar -cpPf /root/bakcup_file.tar /home/$USER/Desktop/$na" >>   backup.sh
  echo "chmod 777 /root/bakcup_file.tar" >> backup.sh
  echo "exit 0" >> backup.sh
#run backup file to back up the folder that you input
  ./backup.sh

#create restoration file
  touch /etc/init.d/restore.sh
  chmod 777 /etc/init.d/restore.sh
  cd /etc/init.d/
  echo "#!/bin/bash" > restore.sh
  echo "rm -fR /home/$USER/Desktop/$na" >> restore.sh
  echo "tar -xpPf /root/bakcup_file.tar" >> restore.sh
  echo "exit 0" >> restore.sh

#Write to boot script: inittab, rc
  grep "/etc/init.d/restore.sh" /etc/inittab >/tmp/inittab.$$
  grep "/etc/init.d/restore.sh" /etc/init.d/rc >/tmp/rc.$$
  ninittab=`cat /tmp/inittab.$$`
  nrc=`cat /tmp/rc.$$`
  if [ "$ninittab" != "/etc/init.d/restore.sh" ]
  then
        echo "/etc/init.d/restore.sh" >> /etc/inittab
  fi
  if [ "$nrc" != "/etc/init.d/restore.sh" ]
  then
        cd /etc/init.d/
        sed -e 's/exit 0//' rc > file.out
        echo "/etc/init.d/restore.sh" >> file.out
        echo "exit 0" >> file.out
        cat file.out > rc
  fi
# remove template file
  rm -f /tmp/input.$$
  rm -f /tmp/ninittab.$$
  rm -f /tmp/nrc.$$

  exit 0
Naturally, if you want the backup tarball or scripts stored somewhere else or named something else, just modify the scripts to indicate the correct directories and filenames.

Any feedback is warmly welcome

Samba and software deployment

Source: http://www.wlug.org.nz

Software deployment is a useful feature of a domain controller, as it allows to distribute software to many clients - and thus, the administrator doesn't have to walk from one workstation to another (10, 20, ... 100 machines...) to install the same piece of software (and uninstall it or upgrade a couple of days later).

One common misconception when comparing Samba to Active Directory, is that with Samba you can't deploy software to your Windows workstations. Another misconception, this time about Active Directory, is that with AD you can deploy software to your workstations. 


So, what's this all about?

Active Directory can only deploy packages in MSI format. This isn't very widely used; mostly software is available in EXE format.

With Samba, as in whole *NIX philosophy, one tool does the job, but does it well.

To distribute software with Samba, one can use WPKG - with this tool, you just configure the software which should be installed / upgraded / uninstalled on a given machine or a group of machines - and next time these Windows workstations are booted, the software you specified is installed / upgraded / uninstalled automatically.

How to Change OpenSUSE user interface from English to Khmer

If you installed openSUSE 11.2 in English language and you wish to change openSUSE Desktop user interface to Khmer, you can follow this instruction :

1. Go to Personal Settings via K menuPersonal Settings (Configure Desktop) → Regional and Language Country/Region & Language

2. In this step, look at the right side and click on Add Language → choose Khmer (if you don't see Khmer, you have to install KDE language pack for Khmer via this instruction) → click Apply

After adding Khmer Language, please make sure that Khmer shows on the top of other languages. This means that KDE Desktop UI will show in Khmer.

3. Logout or restart computer

Hope this will help you

How to setup Khmer(km) translation for KDE

Khmer(km) translation is a package for All the requirement for a desktop in Khmer. This package contain application translations, help files, and a screenshots. (e.g) If you want to change openSUSE user interface from English to Khmer, you have to install Khmer(km) translation for KDE (kde4-l10n-km) before you can change it to Khmer user interface.

To setup kde4-l10n-km for KDE4, you can follow this instruction:

1. Go to Yast via K menuSystemYast (Administrator Settings)

2. In Search box, type kde4-l10n-km and then search that package
→ Tick on kde4-l10n-km that will show on the search result box on right side → click Accept

Note: Please make sure that your system had been already added software repository from openSUSE repository. If not yet, you can add openSUSE software repositories via this instruction.

How to add Software Repositories in openSUSE

Definition from WikiMedia
A software repository is a storage location from which software packages may be retrieved and installed on a computer.

If you keep your computer always connected via a broadband connection, you can install the standard online repository below.


For openSUSE11.2:
Oss :The main repository, open source software only.
http://download.opensuse.org/distribution/11.2/repo/oss/

Non-oss: Non free (as in freedom) software, such as Flashplayer, Java etc.
http://download.opensuse.org/distribution/11.2/repo/non-oss/

For other version, visit here.

To add those repositories, Go to Yast via K menu System Yast (Administrator Settings) → Software software repositories
Then Click Add HTTP →choose Edit Complete URL →then fill some information as following:
  • Repositories name : any names (e.g: oss-11.2)
  • URL of the Repositories: http://download.opensuse.org/distribution/11.2/repo/oss/
Then Click Next → (wait a few minute ) then click NextOK (if you don't wish to add the other repositories)

Note: In case your computer didn't connect via a broadband connection, you can use DVDs repositories for installing any software, but it will ask for DVDs to be inserted every times you install software.

Hope this will help you.

How to make a bootable USB installation stick

Some computers do not have a CD or DVD drive. To install openSUSE on these computers you can make a USB stick that does the same thing as a installation DVD.

1.  First you have to format your stick as FAT32 (either in Windows or in Linux). It needs to be sufficiently large, so 4GB for the Khmer installation DVD, and 8 GB for the normal openSUSE 11.0 installation DVD.

2.  Copy all the contents of the DVD to the USB drive. After that you have to make the stick bootable. To do this you need to install the package syslinux. It is included in the openSUSE dvd, so YaST will take care of that.

Now all we have to do is make the usb stick bootable. You need to do this on the commandline.
First you need know which partition your USB drive has (like /dev/sdb1 or /dev/sdc1). You can find this out by typing this:
mount

It will show you all your mounted partitions. Find the one which is your USB flash drive.
Then you need to unmount the flashdrive. You can do this manually:

umount /dev/sdb1 (or what partition you have)

Or you can click on my computer on your desktop and rightclick your drive and select "safely remove".

3.   The last thing you need is the path where the installation DVD is mounted.

Download a script called mksusebootdisk which will do the rest. It's located here:
mksusebootdisk

Copy this file somewhere on your computer.
Open a konsole and make sure that you are root.

In the following example, I assume that the USB stick partition is /dev/sde1 and that the DVD is mounted in /media/DVD.
Issue this command:

/path/to/script/mksusebootdisk --32 --partition /dev/sde1 /media/DVD

This should take about 20 seconds and you have a fully working bootable USB installation disk!

More information can be found on the openSUSE wiki:
http://en.opensuse.org/SuSE_install_from_USB_drive

10+ mistakes Linux newbies make



This is a guest post by TechRepublic’s Jack Wallen.
Source :  10+ mistakes Linux newbies make


New desktop users can make plenty of mistakes (as can anyone). But knowing which mistakes to avoid, from the start, helps prevent a LOT of frustration. I’ve handled the topic of mistakes new Linux admins make, but never those of desktop users. Here are some of the most common Linux desktop mistakes I see new users make.
Note: This article is also available as a PDF download.

1: Assuming they are using Windows

Although this might seem way too obvious, it’s not. The average user has no idea there are even different operating systems to be had. In fact, most average users couldn’t discern Windows XP from Vista from 7 (unless they are certain Windows 7 was “their idea”). Because of this, new users might believe that everything works (or doesn’t work, as the case may be) as it does in Windows. Make your end users aware that they are using a different operating system — and that it works differently.

2: Trying to make exe files work

Unless you have done your homework and installed WINE, double-clicking those .exe files simply won’t do anything. And when that happens, your end users are going to be upset. I have seen many an end user download an app made for Windows assuming that it will work for Linux. Make it clear to users that Linux, like Windows, will only run applications made for that operating system. This, of course, is tossed out the window when WINE is involved. But new users won’t be using WINE anyway.

3: Choosing the wrong distribution

One of the biggest problems for users is choosing the wrong distribution. Imagine being a new user and selecting Gentoo or Slackware or Fedora! Yes those are all good distributions, but any of them would send a new user running away in fear. If you are in the initial stages of helping a new user out, do yourselves both a favor and choose the distribution carefully. Consider the user’s ability, needs, and hardware before you make that selection. Don’t just jump on board Ubuntu because everyone says you should. A lot of distributions out there are made specifically for new users. Give them all a close examination before making the choice.

4: Not finding software

Because so many new Linux users are migrating from Windows, they think software can be had from the same channels. Most of the time, this is not the case. The new user needs to become familiar with their package management tools right away - especially tools like Synaptic, Packagekit, and Ubuntu Software Center. Each of those tools is a mecca of software where users can most likely find all the applications they need.

5: Sending OpenOffice documents to Microsoft Office users in the default format

I see this so often. New Linux users are proud of the strides they have made but dumbfounded (and sometimes turned back to Windows) because the people they share files with can’t read their formats. Remember, Microsoft products are not good at getting along with other operating systems and other applications. Make sure your new users are saving in file formats that are readable by the Microsoft equivalents.

6: Avoiding the command line

I can’t, for the life of me, figure out why people completely avoid the command line as if it is the most complex tool there is. I know people who can work absolute magic with Photoshop but can’t seem to type a simple rm command at the command line. Why this is I will never know. New users shouldn’t shy away from the command line. Knowing the command line isn’t essential anymore, but it will make them more capable users.

7: Giving up too quickly

Here’s another issue I see all too often. After a few hours (or a couple of days) working with Linux, new users will give up for one reason or another. I understand giving up when they realize something simply doesn’t work (such as when they MUST use a proprietary application or file format). But seeing Linux not work under average demands is rare these days. If you see new Linux users getting frustrated, try to give them a little extra guidance. Sometimes getting over that initial hump is the biggest challenge they will face.

8: Thinking the Windows directory hierarchy translates to Linux

There is no C:\ in Linux. Nor do you use the “\” character. Nor should you use spaces in filenames. These are common mistakes new users make. Trying to map out Windows to Linux, directory for directory, is impossible. You can get as far as C:\ = / and maybe Default User = ~/, but beyond that you’re out of luck. Make sure new users understand that everything starts at / and their most important directory is their home directory (aka ~/ aka /home/USERNAME/).

9: Skipping updates

I have been burned with Windows updates many times. Need I bother mentioning the update from Explorer 7 to Explorer 8? Very rarely has a Linux update fubar’d a system of mine. In fact, I can’t remember the last time it has. So I am always up to date on my systems… and with good reason. Those updates bring new security patches and features to software and should be applied. Having an installation with a security hole is not what your users need, especially on a machine that houses important information.

10: Logging in as root

I really shouldn’t have to say this. But just in case, be sure to tell your users DON’T LOG IN AS ROOT! But… just in case they must… DON’T LOG IN AS ROOT! Instead, have them open up a terminal window and either “su” to root or use “sudo”. And just in case you didn’t hear me the first time, DON’T LOG IN AS ROOT!

11: Losing windows to the pager

The pager is one of the handiest features of the Linux desktops. But over and over, I’ve seen that new users don’t quite understand what the pager is for and what it does. Because of this, they will “lose” their windows from the desktop. Where did it go? It was there a moment ago! I guess it crashed. No. More than likely, they moved it to another desktop. Another desktop? You see where this is going? Help the new user understand what the pager is and how useful it can be.

12: Ignoring security because it’s Linux

A big part of me still wants to boast and say, “In the 12 years I have used Linux, I have never once had a virus or worm or been hacked.” Although that is true, it doesn’t mean I should ignore security. I have witnessed the effects of a rootkit on a Linux machine. They aren’t pretty and data will be lost. Tell your users that they can’t ignore security just because they’re using Linux. Security is crucial, regardless of the OS.

Source: 10+ mistakes Linux newbies make

Sharing a Thunderbird Profile between Linux and Windows

If you are using Windows and openSUSE, it would be to be able to use the same Thunderbird's profile from either the Windows or openSUSE. Before sharing, you should store Thunderbird's profile in FAT32 partition that can be accessed by both Windows and openSUSE.

How to Thunderbird's profile :

1.Copy Thunderbird's profile
For Windows 7, when you download or get mails, they will store in C:\Users\user_name\AppData\Local\Thunderbird\Profiles\xxxxxxxxx.default. So you have to copy that folder (xxxxxxxxx.default) to FAT32 partition (example D:/profile/xxxxxxxxx.default).

2.Edit profile.ini
In Windows 7, Go to C:\Users\user_name\AppData\Roaming\Thunderbird → open profile.ini then change something as bellow :
IsRelative=0
Path= D:/profile/xxxxxxxxx.default (New profile's path)
In openSUSE, you Go to /home/user_name/.thunderbird → open profile.ini then change something as bellow :
IsRelative=0
Path=/windows/D/Profiles/xxxxxxxxx.default (New profile's path. I supposed it's automatically mounted to /windows.)

3. Restart Thunderbird


Reset KDE to default settings

When your Desktop got messy or disappeared some Applets by incidentally removing from panel, and want to reset it to default as what you just installed new OS. let follow this.

Reset your KDE Desktop to default
1.Go to your home folder -> your user (e.g: linux)
2.Show hidden file (view -> show hidden files)
3.Rename ".kde" file to whatever(e.g: old.kde) or delete if using KDE4 or ".gnome" if using GNOME.
4.End current session


Related Documents at Amazon.com :
Linux Annoyances for Geeks
KDE for Linux for Dummies 
KDE Bible (with CD-ROM) 
Koss KDE250 Dual Element Stereophone (Black/Silver) 

Add Icon of My computer in SUSE 11.x

such a newbie question, but it happened when i incidentally deleted an icon (My Computer) from desktop. two years since i have started using OpenSUSE, don't know how to solve, just now i found it. it is quiet easy.

Add Icon link of my computer:
1. right click on Desktop and select "Create New"
2. Choose "Link toi Location"
3. Enter Name : My Computer
4. Enter Link to location (URL) : sysinfo:/
5. (Enter)


Related Documents at Amazon.com :
OpenSUSE 11, Includes "Introduction to Linux" video-DVD, Linux commands
OpenSUSE 11.0 and SUSE Linux Enterprise Server Bible
SUSE Linux Toolbox: 1000+ Commands for openSUSE and SUSE Linux Enterprise

You might also like:

Related Posts with Thumbnails
 
 
 
 
Copyright © The Life and Work