• 🇬🇧󠁿 🇸🇪 🇿🇦 🇮🇪 🇬🇭 🇩🇪 🇪🇺
    European & African
    Drug Discussion


    Welcome Guest!
    Posting Rules Bluelight Rules
  • EADD Moderators: Pissed_and_messed | Shinji Ikari

The EADD Linux Technical Gibberings Thread

I think this might be quite straightforward. Create a new user account. Easiest done in the terminal!

From the terminal:

Code:
you@yourcomputer:~$ [B]sudo adduser testuser[/B]
[sudo] password for you: [B][your password][/B]
Adding user `testuser' ...
Adding new group `testuser' (1001) ...
Adding new user `testuser' (1001) with group `testuser' ...
Creating home directory `/home/testuser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: [B][testpass][/B]
Retype new UNIX password: [B][testpass][/B]
passwd: password updated successfully
Changing the user information for testuser
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] [B]y[/B]
Adding new user `testuser' to extra groups ...
Adding user `testuser' to group `dialout' ...
Adding user `testuser' to group `cdrom' ...
Adding user `testuser' to group `floppy' ...
Adding user `testuser' to group `audio' ...
Adding user `testuser' to group `video' ...
Adding user `testuser' to group `plugdev' ...
Adding user `testuser' to group `users' ...

Then reboot and try to log in to one of the desktop environments as testuser.

If that works then you've just buggered up your settings, not the actual installation, and we can get things from recovered from there.
 
Ooh! That worked yes. Am currently successfully logged in to Unity as 'testuser'. Also logged in successfully to Gnome but switched to Unity as I've not used the latest version of Gnome yet and have been mostly using Unity recenty. My original user account still ain't working (tried it just to make sure) but progress is definitely being made - many thanks, Knock =D<3=D

Hopefully rescuing original account will be as relatively painless as this was :D
 
Good, thought that would work :)

Recovering your proper account is unfortunately not so straightforward - because fuck knows what's fucked! But we can work step by step.

What you need to do is: take a backup of your home directory, clear out your home directory, and then piece by piece copy configuration from the backup into your home directory. Hopefully you can get what's important, and leave behind what's broken.

Here's what to do.
Assuming your proper account is shambles (think it's actually your real name, so change where appropriate), and working as testuser, from a terminal:

Code:
testuser@yourcomp:~$[B] sudo su -[/B]
[sudo] password for testuser:[B] [testpass][/B]
root@yourcomp:~# [B]cd /home[/B]
root@yourcomp:/home#[B] cp -pr shambles shambles-backup[/B]

then wait a bit. This is the backup being taken. When it's finished, check that it worked, by getting the size of your home directory and the size of the backup, and comparing them; they should be the same. Use the du (disk usage) command. We'll use the -s and -h options - summary, human-readable.

Code:
root@yourcomp:/home# [B]du -sh shambles[/B]
13G      shambles
root@yourcomp:/home# [B]du -sh shambles-backup[/B]
13G      shambles-backup

Yours probably won't be 13G, the important thing is that the two figures are the same.

Once you've done that, purge the real home directory. Type this very carefully!:

Code:
root@yourcomp:/home#[B] rm -rf shambles/* shambles/.*[/B]

This will remove everything (*) including the hidden files (.*) in your home directory. At this point you will be able to log out as testuser and log in as yourself - but everything will be reset, as if you had never used the computer (well, if you changed your password that will remain changed; and any software you installed you will still be installed; but there will be no Firefox bookmarks, for example, and any desktop tweaks you made will be gone). The next step will be to copy some files in from shambles-backup into shambles. But we want to be selective. So before we start, let us know when you get this far.
 
Last edited:
Hmm... I probably won't do this tonight as I know I don't currently have enough disk space to backup my Home folder. It's only stuff wot needs watching that's taking up space though so is all disposable. Pooter is currently usable (albeit involving a bit o' faff here and there, perhaps) so might just watch and delete some of the stuff that's clogging up space before embarking on further remedial action. I actually haven't made too many changes (not important ones anyway) and is mainly FF stuff (Bookmarks, Add Ons and the like) that I'm not wanting to lose. It may even be easier to use... that FF Add On I forget the name of but used to use frequently that backs up your FF setup so I can use that stuff on this account then simply make this one the Admin account and get rid of original one completely. Will have a ponder about the options whilst steadily clearing enough space to back up my original user account anyway.

Will get back to you as and when but for now many thanks for assistance so far :)<3
 
@ knock: I know all about chmod +s -- but it doesn't work on shell scripts, by design. It's a feature of the shell. Most of the time it's actually desirable, but occasionally you run into a need to do something only root can usually do. In my case, talk to Asterisk from a CGI script which runs as the low-privileged www-data user. I don't want to be giving out full root privileges, but I can live with a small subset of Asterisk CLI commands in the wrong hands.

Prove it like this:
Code:
#!/bin/bash
echo $LOGNAME
Even if that is chown-ed to root and chmod-ed ug+s, it will always print your login name, not "root".

CGI scripts, even in bash, can setuid to a non-root user (still more privileged than www-data) if you install an apache module; but they're being started through apache, not through bash. I've used this for advanced CGI scripts that write files in users' home folders.

Another way to do root-ish stuff via CGI is to wtite root commands to a file or database, and have a root cron job reading them, sanity-checking and executing them. But this method is laggy, and I needed real-time functionality.
 
Julie, why do you need root privileges? Everything in Unix is a file. Are you needing access to a file? put your user in the correct group and permission the file appropriately.
 
I need to send commands to a running Asterisk process;
Code:
/usr/sbin/asterisk -rx '...'
This works from the bash prompt as root, obviously; but not as a normal, user because the socket /var/run/asterisk.ctl is only writable by root. This is on a box which is plugged straight into the Internet, by the way.

Now, I only actually want to issue a limited range of Asterisk CLI commands as www-data (since I'm doing it from a CGI script). I think liberalising permissions would actually make everything less secure, since the www-data user then would be able to execute arbitrary Asterisk commands. And giving www-data full sudo access would be suicidally stupid. At least my few little setuid binaries can only do the commands I programmed into them .....
 
I did not read the entire problem descriptions here. But I had similar problems with Ubuntu/Mint in the past as Shambles. Often the cause of the error was a unexpected change of user permissions in the home-folder ('sudo chown -R user folder' and 'chmod -R 755 folder' as a lazy cure). Or the different Display Managers (mdm and gdm etc.) concurred with each other. After I while I got fed up with that pre-configured instable setup and installed ArchLinux and now I have (subjectively) :

- customization as a central architecture principle
- better package manager (pacman), more recent and versatile than apt-get/aptitude
- no problems with display managers, I simply did not install one in the first place (what the F for anyway? you can start X from the console)

Really impressed so far (after a few months usage).
 
'sudo chown -R user folder' and 'chmod -R 755 folder' as a lazy cure

Lazy and horribly insecure, you've missed group ownership entirely, if some "unexpected" change has occurred, shouldn't that be addressed? Then you've given the world read and execute access to every fucking file in your home directory. Apart from revealing your innermost secrets to anyone else with an account on your box (possible on a shared computer, I often create a guest account on my computer so others can use it without giving them access to my stuff) you'll break ssh. And it's just messy to have every file executable. I'm not OCD in real life but when it comes file permissions I like to have things at least sort of right.

A cleaner solution in the same vein would be, from your home folder:

Code:
sudo chown -R user:user .
find . -type d -exec chmod 750 {} \;
find . -type f -exec chmod 640 {} \;

This will make directories executable, which they have to be. It will give you, the owner, full access to your files, and anyone in your group read access only. And no access to the "world". Any plain file that needs to be executable will need addressed separately, but most people don't have many executables in their home directory.

Oh yeah, that might still break SSH, so:

Code:
find .ssh -type f -exec chmod 600 {} \;

Arch - really not the best recommendation for people who are not yet comfortable using a traditional UNIX shell, and who's primary goal is to use their computer, not learn about it.
 
Last edited:
Lazy and horribly insecure, you've missed group ownership entirely, if some "unexpected" change has occurred, shouldn't that be addressed? Then you've given the world read and execute access to every fucking file in your home directory.

Now I understood what you meant. But where did I write, that you should do "chmod -R 755 ~" ? I forgot to add, that you could try that incrementally with every folder (probably .gdm or similar), that needs to be read/executed by the Display Manager (I don't know, since I do no use that stuff). You're right, that the entire home directory should not get read/execute rights for others.


Regarding arch : I don't know if your statement was an indirect allusion on my shell skills. Anyway, after the installation of a Desktop Environment Arch's usability is as good as any other Linux. There are NO difference other than those I mentioned above (subjectively).
 
Last edited:
Well which folder exactly were you on about then?

Depends on the problem/error. In the aforementioned case it should have had something to do with the Dialog Manager. I'm sure there are better solutions. But I should mention, that I had similar, albeit not identical, errors/problems (dm/X related issues) with Ubuntu and Mint (various versions) on 3 different hardware systems. Instead of learning about the bugs, deposited by Dialog Manager - devs I decided to install a distro, that does not force flawed components on you by default. I think I went the economically more reasonable path :)
 
^ Nerd. Nerdy nerd. Neeeeeeeerrrrrrrd!!

My army of androids (and I don't talk about embedded operating systems), equipped with self-designed, freshly 3D printed 30mm phaser cannons will arrive at your front door in the Langford Road in 27 seconds, giving you the chance to defend yourself via broadcasted video conf. If you don't see/hear them coming you are probably too drugged up. ;)
 
Think I'm going to stick together a little CD with just enough of Debian on it to run Asterisk, Apache and MySQL (no PHP, I am going off it to be honest. Got too used to free and easy PHP4, and don't like the way PHP5.4+ is going. Anyway, I'm doing just fine with Perl nowadays). And some scripts of mine, obviously.

Who wouldn't want their own home telephone exchange?
 
Think I'm going to stick together a little CD with just enough of Debian on it to run Asterisk, Apache and MySQL (no PHP, I am going off it to be honest. Got too used to free and easy PHP4, and don't like the way PHP5.4+ is going. Anyway, I'm doing just fine with Perl nowadays). And some scripts of mine, obviously.

Who wouldn't want their own home telephone exchange?

Can you explain to me in a sentence or two what Asterisk actually gives you in your home? I've known about it for years and even read a bit about it but I just don't understand what use it could possibly be if you don't have more than one phone line coming into your premises. If someone is on the phone, the line is in use and everyone else gets the engaged tone. So where are all these calls getting routed to and from? Or have I totally misunderstood it?

I think it can work as a fancy answering machine with interactive menus and stuff like we all so love when we try and get a customer service representative. Why on earth would anyone see that as GOOD thing to add to their own phone? :D

PLUS if you do have more than one phone line, surely you need loads of modems to hook up to them? :?

VOIP I can sort of see. And I can imagine how a business might use it (I believe the main developer created it for his tech support business and while his business went down the pan Asterisk was a wild success. Listened to a podcast interview with him a while back).
 
mine runs voicemail, incoming phone which also connects to my mobile when im at home. it's very handy.
 
Top