Changing user permissions

6 replies [Last post]
jaisgossman
Offline
Joined: 06/18/2018

Hello everybody,

I'd like to know how to change the permissions of different users on one computer running (what I believe to be) the most recent Trisquel. I have created two users, and I would like to, for example, be able to look into files of one user while logged in as the other. How do I go about doing this? And as I start getting acquainted with the terminal, is there a way to describe how to do this in a quick summary?

Geshmy
Offline
Joined: 04/23/2015

This might work
1. List groups from the file /etc/group:
$ cat /etc/group
Let's say I find a group: user1:x:1000:
If I wanted another user to access user1's files I could try...

2. If you have sudo set up use the usermod command like so (very important not to omit the -a as it means 'append' not 'replace.')
$ sudo usermod -a -G user1 user2 (I am putting user2 into the user1 group)

Now user2 is in user1's group

if user1 is not a sudoer then I would have to log in to the root account by

$ su
and enter roots password

then run simply

# usermod -a -G user1 user2

Looking at my Desktop folder by opening a terminal on the Desktop and using
$ ls -als
I see listed (ls) a graphic file: 4 -rw-r--r--. 1 user1 user1 3448 Jun 30 07:51 systemd.svg
-rw-r-r-- means owner (gsmyli) can read and write to the systemd.svg, owner's group can read the file.

If user1 is set up as a sudoer then he can always look at user2's files by using the sudo command.

I am sure's lots of other ways to accomplish what you want.

jaisgossman
Offline
Joined: 06/18/2018

I'm working on this, it is tedious learning, but perhaps I want a more simple way to do this, if possible? By this I mean working through GUI, making accounts accessible to the sysadmin. right now, my default login is jais as user. I created another account for different work I'm doing, such as a coop, and this is the user newlc. Simply put, how do I get that stupid X off the newlc file image when looking at it in the home file window?

here's how I went about looking at this stuff in the terminal

jais@Ding-bat:/home$ ls
jais newlc terracemill
jais@Ding-bat:/home$ cd newlc
jais@Ding-bat:/home/newlc$ ls
ls: cannot open directory '.': Permission denied
jais@Ding-bat:/home/newlc$ ^C
jais@Ding-bat:/home/newlc$

Do I have to be in a specific directory to run the commands you layed out above?

here's how I input the first commands, let me know what I'm doing wrong.

jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x:1002:
[sudo] password for jais:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ su
Password:

realize I omitted some colons but still no go

usermod: group 'newlc:x1002:' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x1002 jais:x:1000:jais
usermod: group 'newlc:x1002' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x:1002: jais:x:1000:jais
usermod: group 'newlc:x:1002:' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x:1002 jais:x:1000:jais
usermod: group 'newlc:x:1002' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x:1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000: newlc:x1002:
usermod: group 'jais:x:1000:' does not exist
jais@Ding-bat:~$

I feel like I'm missing something very obvious...

jaisgossman
Offline
Joined: 06/18/2018

I'm working on this, it is tedious learning, but perhaps I want a more simple way to do this, if possible? By this I mean working through GUI, making accounts accessible to the sysadmin. right now, my default login is jais as user. I created another account for different work I'm doing, such as a coop, and this is the user newlc. Simply put, how do I get that stupid X off the newlc file image when looking at it in the home file window?

here's how I went about looking at this stuff in the terminal

jais@Ding-bat:/home$ ls
jais newlc terracemill
jais@Ding-bat:/home$ cd newlc
jais@Ding-bat:/home/newlc$ ls
ls: cannot open directory '.': Permission denied
jais@Ding-bat:/home/newlc$ ^C
jais@Ding-bat:/home/newlc$

Do I have to be in a specific directory to run the commands you layed out above?

here's how I input the first commands, let me know what I'm doing wrong.

jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x:1002:
[sudo] password for jais:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ su
Password:

realize I omitted some colons but still no go

usermod: group 'newlc:x1002:' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x1002 jais:x:1000:jais
usermod: group 'newlc:x1002' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x:1002: jais:x:1000:jais
usermod: group 'newlc:x:1002:' does not exist
jais@Ding-bat:~$ sudo usermod -a -G newlc:x:1002 jais:x:1000:jais
usermod: group 'newlc:x:1002' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000:jais newlc:x:1002:
usermod: group 'jais:x:1000:jais' does not exist
jais@Ding-bat:~$ sudo usermod -a -G jais:x:1000: newlc:x1002:
usermod: group 'jais:x:1000:' does not exist
jais@Ding-bat:~$

I feel like I'm missing something very obvious...

Magic Banana

I am a member!

Offline
Joined: 07/24/2010

You can certainly achieve the same thing (adding you to the group bearing the name of another user) with the "Manage Groups" button of the "User and Groups" utility in the "Control Center".

jaisgossman
Offline
Joined: 06/18/2018

here's what I tried, to no avail. I am logged in as jais, and I would like to place files in newlc's folder.

Screenshot at 2018-12-13 19:49:45.png Screenshot at 2018-12-13 19:54:39.png
Magic Banana

I am a member!

Offline
Joined: 07/24/2010

You can change the permissions of a file or a folder from its "Properties" you access through the contextual menu you get right-clicking on it in the file browser. You can in particular give the writing permissions to the group. But you must already have the writing permission to change the permissions (you can given other users access to the file you can modify). Or, if you are an administrator of the system, you can use 'sudo chmod' in a terminal (be careful: do NOT change the permissions of system files!). To add ("+") for the group ("g") the permission to write ("w") permission in /home/newlc:
$ sudo chmod g+w /home/newlc
For all the files/folders directly in /home/newlc:
$ sudo chmod g+w /home/newlc/*
For all the files recursively ("-R") in in /home/newlc:
$ sudo chmod-R g+w /home/newlc

See http://write.flossmanuals.net/command-line/moving-around/ and http://write.flossmanuals.net/command-line/superusers/ and http://write.flossmanuals.net/command-line/permissions/ for an introduction to "moving around", to "sudo" and to "permissions".