петък, 21 декември 2012 г.

How to reset your root password

Couple of ways to reset your password, if you happen to mess it.
First, if you are in KDE (or whatever) and you know your sudo password, it is very easy to recover your pasword:
$sudo su -
$passwd
and type your new password.
(source)
And that's it.

If you happen to have lost your sudo password as well, you can do it the hardcore way.

First, you need to edit the kernel boot load in GRUB to reboot into single use mode by adding "init=/bin/sh". That's very useful if you screw your X and you cannot enter terminal the normal way.
Now, you have to remount the disk into read-write mode:
$mount -o rw,remount /dev/ROOT
in my case
$mount -o remount,rw /
Now do:
$nano /etc/shadow
and on the line root you need to remove everything between the first and second :
Then save and use
$password
to change your password. Then reboot. (source)
Third, there is the chroot way. I never done that, but I'll paste it here for completeness. And for desperate cases. Now, you need a LiveCD.
From it do:
$mount /dev/hda3 /mnt/gentoo
$mount /dev/hda1 /mnt/gentoo/boot
$mount -t proc none /mnt/gentoo/proc
where /dev/hda3 is your / , /dev/hda1 is your /boot, and /dev/hda2 is your swap.
Then do
$chroot /mnt/gentoo /bin/bash
which is supposed to change the environment from LiveCD to your PC. Sounds pretty creepy if you ask me.
Finally, do:
$passwd
and change your password. Then reboot and be happy.
(source)
P.S. If this way of chroot-ing doesn't help, then you can try:
# chroot /mnt/gentoo /bin/bash
# env-update
>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"
#passwd
(source)

понеделник, 17 декември 2012 г.

How to start samba on Gentoo (successfully)

I never managed to run samba successfully but today, we had a break trough.
So, here's how to run samba on Gentoo
0. To install samba:
$sudo equo install samba
1. If you don't have a smb.conf then do
$sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf
2. Add to smb.conf:
usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False
3. Do (following http://ryan.rawswift.com/2009/03/04/how-to-share-folders-in-linux-using-samba/):
$ sudo mkdir /var/lib/samba/usershares
$ sudo chgrp users /var/lib/samba/usershares/
$ sudo chmod 1770 /var/lib/samba/usershares/
4. Then all you need to do is restart samba.
$sudo /etc/init.d/smb restart

If you happen to prefer gui for samba, there is a way. (see http://en.gentoo-wiki.com/wiki/Samba#GUI_administration or http://www.gentoo-wiki.info/HOWTO_Setup_Samba#SWAT)
0. If samba doesn't start on reboot:
$sudo rc-update add samba default
1. $sudo equo install xinetd
2. $rc-update add xinetd default (optional)
3. $echo "net-fs/samba swat" >> /etc/portage/package.use (optional)
4. $sudo nano /etc/xinetd.d/swat
In it, make sure that you have:
service swat
{
port = 901
socket_type = stream
wait = no
only_from = 0.0.0.0
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}
Check that: "disable=no"!
6. Now you need a root password for samba
$smbpasswd -a root (for samba <3.4.6)
or
$pdbedit -a -u root
7. /etc/init.d/xinetd restart
8. To enjoy the gui, type in Dolphin or Konqueror or Nautilus:
http://localhost:901/
If swat won't run, check your firewall settings.

After setting samba root password with "$smbpasswd -a root" we managed to mess the system root password (no idea how). To reset the root password, you can do:
$sudo su -
$passwd
(source)
Now, your root login should work and everything should be peachy. If when accessing your samba folder, it asks you for a password, then use "root" and the password you set with $pdbedit -a -u root

четвъртък, 13 декември 2012 г.

How to install a Gentoo ebuild on Sabayon

Maybe this one is pretty obvious, but I decided to paste it here just in case.
So you want to install some package, which is available in Gentoo's portage, but not in Sabayon's entropy. It turned out it's quite easy. Thanks to this site:

"Set PORTDIR_OVERLAY in /etc/make.conf to, say, /usr/portage/local then
mkdir -p /usr/portage/local/net-misc/wicd, copy the ebuild to that
directory then do
ebuild /usr/portage/local/net-misc/wicd/wicd-1.3.8-r1.ebuild manifest
and emerge it in the usual way."

In my case, I wanted to install BlueGriffon.
My PORTDIR_OVERLAY is  /usr/local/portage/myoverlay/"
I created: /usr/local/portage/myoverlay/dev-util/bluegriffon-bin
I copied the ebuilds I downloaded to this path.
and then I did:
$sudo ebuild bluegriffon-bin-1.5.2.ebuild manifest
$sudo emerge bluegriffon-bin-1.5.2.ebuild
On my first try, I got an error with eutils.eclass . You can find this file on this link and it should reside in /usr/portage/eclass/eutils.eclass .
I didn't need to download it manually from there, since doing
$sudo emerge --sync solved the problem.
And that was it! Blue Griffon is happily installed.