Moving files from one user to another / file recovery before re-installing
- Inicie sesión ou rexístrese para enviar comentarios
Through messing around with the command line, I have somehow made it impossible to login again to the GUI of main account I use on my system. I think I will just be doing a re-install. But I would like to get some files off of this user account before I do so.
What is the best way I can do this? I have attempted to move all the files from one user to another with "cp -r /home/jais /home/terracemill", but it returns
"cp: cannot access '/home/jais .cache/dconf': Permission denied"
what am I doing wrong here? I would like to move the files of user "jais" to the user "terracemill." how do I do this?
I'm also wondering if it's possible to move the files to a flash drive through the virtual terminal, and if so, how to do this.
Thanks in advance.
> Through messing around with the command line, I have somehow made it
> impossible to login again to the GUI of main account I use on my
> system.
What did you do? Were you installing/removing packages? It's possible
that something important got removed. Try running
$ sudo apt install trisquel
or if you use Trisquel mini,
$ sudo apt install trisquel-mini
and rebooting.
> But I would like to get some files off of this user account before I
> do so.
>
> What is the best way I can do this?
If you boot into a live session from a USB drive, you should be able to
mount your computer's hard drive using the graphical file manager and
copy your files to another medium. If you installed Trisquel with full
disk encryption or an encrypted home directory, you will need the
password to decrypt the volume. Otherwise it should just work.
I was doing a bunch of things, and tracking down the cause seems to be a lost cause. I was using the virtual terminals tyy1, 2, etc... I will do better documentation from here on out certainly!
Before I try putting the files onto an external drive, I would like to at least attempt to move them around on the computer. I tried running sudo apt install trisquel to no avail. The problem remains that I can only log into the GUI of the two alternative users I have set up on the computer. When I attempt to log in to 'jais', it looks like something is happening, but I am brought back to the 'splash/login page' (the default sound of a water droplet occurs again, as if I have just booted up).
So two things I'd like to try:
Move files from one user to another user. from user jais --> user terracemill and/or newlc
Reaccess the GUI of the target user 'jais'.
> So two things I'd like to try:
> Reaccess the GUI of the target user 'jais'.
The fact that you can log into a graphical session as another user means
that the problem is not system-wide, but specific to your user's
configuration. It is likely that the culprit is in your .config
directory. Log into a TTY as jais, and run
$ mv .config .config~
and then attempt to log in graphically. What will probably happen, is
you'll be able to to log in, but most of your settings will have
returned to the defaults.
Next take a look at the .config~ directory. Note that since the
directory name begins with a "." it will be hidden by default. In a
terminal, you'll need to use "ls -a" instead of "ls" to view it. In the
graphical file manager, you can use Ctrl+H to toggle the visibility of
hidden files and directories.
In .config~, you'll see files and directories corresponding to different
sets of preferences. For example, the "libreoffice" directory will
contain your LibreOffice settings. One of the settings in one of these
files or directories is probably what was breaking your graphical
session. By renaming .config to ~/.config, all of your settings are now
ignored. Now we want to restore them.
Recreate the .config folder, copy over a few of the preferences you want
to restore from .config~, log out and log in. If you can still log in,
then you know that none of those preferences was the problem. If not,
back up and use trial and error to figure out which setting did it.
Keep going until you either find the culprit, or have copied over all
the preferences that are important to you.
> Move files from one user to another user. from user jais --> user
> terracemill and/or newlc
Each user's files are in their home directory. Your home directory is
/home/jais, and terracemill's and newlc's are /home/terracemill and
/home/jais respectively. Your Documents, Downloads, Music, etc.
directories are in your home directory, so for example your Documents
are in /home/jais/Documents. So what you want to do is copy files from
your home directory to another users home directory.
In order to copy files between users, you need to do so as root. You'll
also need to (as root) change the owner of the files so that the new
user has permission to access them.
### The terminal way ###
In a TTY, login as jais and run
$ sudo su
The "$" will change to a "#", indicating that you are now root. Now you
can copy files between user home directories. Let's make a folder in
terracemill's home directory called "jais-files".
# mkdir /home/terracemill/jais-files
To copy a file in your Documents directory called "file.txt" to
jais-files, run
# cp /home/jais/Documents/file.txt /home/terracemill/jais-files/
and to set terracemill as the owner of the new copy of the file, you
then run
# chown terracemill:terracemill
Or, say you want to just copy all of your files over, run
# cp -a /home/jais/* /home/terracemill/jais-files chown -R
# terracemill:terracemill /home/terracemill/jais-files
Or, if you don't have enough disk space to duplicate all of your files,
move them instead of copying
# mv /home/jais/* /home/terracemill/jais-files chown -R
# terracemill:terracemill /home/terracemill/jais-files
### The graphical way ###
If terracemill and/or newlc has sudo privilages, log into a graphical
session as them and run,
$ gksudo caja
This will open the file manager as root, and you'll be able to drag/drop
or copy/paste files between user home directories. To change
permissions, right click on a file or directory and go to Properties ->
Permissions.
If terracemill and newlc don't have permission to use sudo, you can
either give them permission by logging into a tty as jais and running
$ sudo usermod -a G sudo terracemill # (or newlc)
or you can boot from a live USB, mount your hard disk, and use the file
manager to move or copy the files.
wow!! thanks for the thorough response.
Still unable to access the GUI of jais, but I did manage to move the files into terracemill. I did not run chown -R, I simply copied them over with "# cp -a /home/jais/* /home/terracemill/jais-files". I am operating from the terracemill GUI, and I seem to have no problem accessing the file. What does the change ownership do?
One more question: Is it possible to mount an external drive in the terminal?
I guess one more question regarding nomenclature in our exchange: what is a standard way to quote entries in the terminal? I am using quotations marks, and I see you preface your entries with either # or $. When inputting text, I am unsure how line breaks in this forum should be translated into my entering them into the terminal.
you write:
# mv /home/jais/* /home/terracemill/jais-files chown -R
# terracemill:terracemill /home/terracemill/jais-files
are these two lines two separate entries in the terminal, or is this one command broken into two lines?
what is best practice in forums like this when showing work?
> Still unable to access the GUI of jais, but I did manage to move the
> files into terracemill. I did not run chown -R, I simply copied them
> over with "# cp -a /home/jais/* /home/terracemill/jais-files". I am
> operating from the terracemill GUI, and I seem to have no problem
> accessing the file. What does the change ownership do?
Did you try editing any of the files, or just opening them? Since you
copied them as root I think that they should owned by root, in which
case terracemill might have read access but not write access to the
files.
> One more question: Is it possible to mount an external drive in the
> terminal?
Yes. First you need the path to the device, which will be under /dev.
If you machine has one hard drive, then usually that will be /dev/sda,
and if you plug in a USB device that will be /dev/sdb. If you plug in
another USB device during the same session it will be /dev/sdc, and so
on. Each volume may have multiple partitions, like /dev/sda1,
/dev/sda2, /dev/sda3, etc. To figure out which volume and which
partition of that volume you need to mount, look at the output of
$ lsblk
To mount it, you need a directory to mount it to. I typically do this
under /mnt, for example:
$ sudo mkdir /mnt/mydrive
Then you actually mount it. Say our USB drive is /dev/sdb, with a
single partition sdb1, we'd do
$ sudo mount /dev/sdb1 /mnt/mydrive
now the files on the USB drive are available under /mnt/mydrive, and we
can do what we need to do.
When you are all done, unmount with
$ sudo umount /mnt/mydrive
and, if this is a one-time thing, clean up by deleting that (now-empty)
directory
$ sudo rm -rf /mnt/mydrive
Note that this method mounts the drive as root, which means that if you
copy files to/from the device, they may be owned as root and require a
change of permissions later.
> I guess one more question regarding nomenclature in our exchange: what
> is a standard way to quote entries in the terminal? I am using
> quotations marks, and I see you preface your entries with either # or
> $. When inputting text, I am unsure how line breaks in this forum
> should be translated into my entering them into the terminal.
"$" means to run the command as a regular user, whereas "#" means to run
the command as root. You'll notice that most of the time the terminal
prompt ends with a "$", but if you run "sudo su" to become root, the "$"
will change to a "#".
> you write:
> # mv /home/jais/* /home/terracemill/jais-files chown -R
> # terracemill:terracemill /home/terracemill/jais-files
>
> are these two lines two separate entries in the terminal, or is this
> one command broken into two lines?
Those are two separate commands, each run as root.
> what is best practice in forums like this when showing work?
$ for commands as a regular user and # for commands as root seems to be
pretty standard.
- Inicie sesión ou rexístrese para enviar comentarios