Shady Goings On

12/5/2009

Safely reboot a locked up linux box: REISUB

Filed under: — ShadyCraig @ 12:36 pm

As a last resort on a locked-up linux box you might hold down the power button to restart it. This is not great as the discs will still be mounted.
A safer way is to hold down Atl-SysReq while slowly typing “REISUB”. This will reboot the box safely.

What it does:

  • R: Switch the keyboard from raw mode to XLATE mode
  • E: Send the SIGTERM signal to all processes except init
  • I: Send the SIGKILL signal to all processes except init
  • S: Sync all mounted filesystems
  • U: Remount all mounted filesystems in read-only mode
  • B: Immediately reboot the system, without unmounting partitions or syncing

You can also type “REISUO” to power off, rather than rebooting.

5/2/2009

Setting up Samba on Fedora 7

Filed under: — ShadyCraig @ 9:52 pm

I decided to set up Samba so that I can use access my files on my linux PC from other PCs.
How’s how:

[root@localhost ~]# yum install samba
[root@localhost ~]# /etc/init.d/smb restart

The lines above will install and start Samba. The default config will allow each user access to their home directories, so you should now be able to access the share from a windows pc.
On the Windows PC press Start then select run and enter \\192.168.0.1 (or whatever the hostname or ip address of the Samba server). A folder will appear showing a directory with your home directory, and maybe some other shares such as printers. Navigating into the home folder should show your files, but this didn’t work for me. Instead Windows showed an error saying that the sahre does not exist and the following error was shown in the samba log file:

[root@localhost ~]# tail /var/log/samba/log.192.168.0.2
[2009/02/05 18:48:27, 0] smbd/service.c:make_connection_snum(1003)
'/home/user' does not exist or permission denied when connecting to [user] Error was Permission denied

As it turns out this was SELinux (access control system) was preventing the access due to the default policies. The following allowed the access and the share was then accessible from windows:

[root@localhost ~]# setsebool -P samba_enable_home_dirs on

26/1/2009

Less typing with environment variable CDPATH

Filed under: — ShadyCraig @ 1:09 pm

Using the CDPATH environment variable can make life easier, especially if you often change to particular directories.
See this post on Lars Strand’s blog:
Less typing with environment variable CDPATH - Lars Strand

28/2/2008

If you forgot your root password on Linux…

Filed under: — ShadyCraig @ 8:00 pm

Don’t worry! You can set a new one if you have sudo set up on your system.
See my post about setting up sudo on your linux box if you haven’t already…

sudo allows a regular user to perform single commands as root (or another user), this can be used to set a new password for root and is also safer than using su on it’s own for general admin tasks.

To set a new password for root::
[shady@localhost ~]$ sudo passwd
Password:
Changing password for user root.
New UNIX password:
Retype new UNIX password:
Password updated

[craig@localhost ~]$
Well done! Now you can be root again!

17/9/2007

ASRock N8NF6G-VSTA audio on Fedoda 7 Linux

Filed under: — ShadyCraig @ 10:10 pm

Since I installed Fedora on my pc I haven’t had any audio, a shame but I’m not too bothered.

Any way today I thought I’d have a stab at getting it working. The audio comes through an on-board chipset. by Realtek. Thankfully they have the Linux drivers available on their site (see others) and was a simple download/install/reboot job and I now have audio.

Next I’m looking at how I can play my Windows games on Linux.
The main methods seem to be either using Winex or Cedega

20/7/2007

Get sudo working on Fedora 7

Filed under: — ShadyCraig @ 10:35 pm

A handy feature of Fedora 7 (and most Linux’s) is to be able to run a command as admin (root). In the past I’ve done this by using su but it’s not really a good idea for security reasons.
Using sudo will just run the one command as root, so it’s a lot safer, plus you give your own password - not roots. Here’s how I set it up.

Open a terminal session (look in the menu under Applications -> System Tools).
Then type:

[craig@localhost ~]$ su
Password:
[root@localhost craig]# /usr/sbin/visudo

You will now be in a vi-like editor.
Find the line like root ALL=(ALL) ALL and make a copy of that line just below it.
Substitute your user name for root.
Type [esc]:wq (that’s the escape key followed by colon then wq then enter)

You will now be back at roots command prompt, type exit to return to your own command prompt:
[root@localhost craig]# exit
[craig@localhost ~]$ whoami
craig
[craig@localhost ~]$

As you can see above, the whoami command prints the userid is use.
You can now use this to test out your newly configured sudo!

[craig@localhost ~]$ whoami
craig
[craig@localhost ~]$ sudo whoami
Password:
root
[craig@localhost ~]$

Note that the password entered is your own - not roots!

  • Categories

  • Meta

  • Listed on BlogShares
  • Valid CSS!
  • Valid XHTML 1.0!
  • Powered by WordPress