Tech Support banner

1 - 8 of 8 Posts

·
Registered
Joined
·
531 Posts
Discussion Starter #1
Greetings,

I am using v1909 of Windows 10, and I have successfully enabled the Linux subsystem and downloaded an Ubuntu shell from the Windows Store. I have an archive file on a flash drive which I need to copy to a specific folder I created, then extract the archive.

I have used Ubuntu in the past. It was an entire OS install which included a GUI file manager. This does not have that capability. So, this leaves me needing to use console commands. I know a few, such as "cp" which is used to copy files. My problem, at this moment, is identifying specific drives. I am not sure how to point to a file on another drive while in the destination folder.

If this post is in the wrong location, and it may be, feel free to move it.

Any assistance would be appreciated. Thank you! :smile:
 

·
Registered
Joined
·
531 Posts
Discussion Starter #3
Thank you for the reply!

I found a way to cheat it. I had created a folder inside the Ubuntu shell. I used a Windows Command Prompt to do a directory search for that particular name. I found it way down deep in the User\Appdata area. I used the Windows File Explorer to navigate to the folder and pinned it to the Explorer. Now, I can move simple things in and out without difficulty. I had a tar archive I had to extract and I did that in the shell with a Linux command. It is an executable program with its support files.

When I tried to run the program, it listed files it could not create or find. Using sudo solved the problem. The shell is based on Ubuntu 20.04 LTS. Being that restricted, I don't know if there is a way to permanently set the permissions higher so that I would not need to use sudo each time I loaded it. If I stop the program and allow it to sit just a short time, I have to enter the password again to restart it. Other times, not.

If you have any ideas, I would like to see them. :smile:
 

·
Moderator , Security Team
Joined
·
768 Posts
Not tried the Linux Subsystem on Windows yet, so I'm not exactly sure what restrictions it has.

In Linux file/folder permissions are changed using the chmod command.

For more detail see ... https://linuxjourney.com/lesson/file-permissions

If you have a number of commands you need to run, and need super-user permissions, then there's 2 ways to do it ....

1. Using sudo for each command
2. Using su ... https://linuxjourney.com/lesson/root-user ... in which case you're logged in as Root and can do pretty much anything. This is not without risk, and it's easy to screw things up, so it's not something I'd advise for a newcomer to Linux.
 

·
Registered
Joined
·
531 Posts
Discussion Starter #5
..In Linux file/folder permissions are changed using the chmod command.

For more detail see ... https://linuxjourney.com/lesson/file-permissions
chmod works, but not in the same way. One section in the link refers to using numbers. Combinations of 1, 2, and 4 added. 1 is read, 2 is write, and 4 is execute. Adding them all together would be 7 and there is an example of this. chmod 7 prog_name. Doing this killed everything. I got it back by setting it to 1 and using sudo.

The first page shows a different method and this is confusing. It says using ls -l will display the permissions. I am familiar with ls as I have used it before. My program looked like this: -------rwx 1 500 500 then the program size, date, and so on. A text document in the same folder looked like this: -rw-r--r-- root root and the other information.

I think the best thing, for me, is to leave all this alone and stick with sudo. My program runs properly. That's the important part.

Thank you. :smile:
 

·
Windows Tech Team
Joined
·
1,012 Posts
Unless something has changed radically with chmod, it always uses a 3 digit series, with each digit representing some combination of read-write-execute permissions for, in order: owner(user), group (that the user is a part of), and others.

chmod 777 blah gives read write and execute permissions to everyone (which you don't do often)

chmod 744 gives the owner full permissions with other group members, and others outside the group read only permissions.

0 - all permissions excluded (seldom used, and generally only for group/others)
1 - execute
2- write
3 - write and execute
4 - read
5 - read and execute
6 - read and write
7 - read, write, and execute

in each position. (I'm ignoring the superuser bit, as it's very seldom used and would occur to the left of the 3 digit sequence, and is either 0 [doesn't have superuser/root permisson] or 1 [has superuser/root permission] and that can only be set by someone who has superuser/root permissions.
 

·
Registered
Joined
·
531 Posts
Discussion Starter #7
Unless something has changed radically with chmod, it always uses a 3 digit series, with each digit representing some combination of read-write-execute permissions for, in order: owner(user), group (that the user is a part of), and others.

chmod 777 blah gives read write and execute permissions to everyone (which you don't do often)

chmod 744 gives the owner full permissions with other group members, and others outside the group read only permissions.

0 - all permissions excluded (seldom used, and generally only for group/others)
1 - execute
2- write
3 - write and execute
4 - read
5 - read and execute
6 - read and write
7 - read, write, and execute

in each position. (I'm ignoring the superuser bit, as it's very seldom used and would occur to the left of the 3 digit sequence, and is either 0 [doesn't have superuser/root permisson] or 1 [has superuser/root permission] and that can only be set by someone who has superuser/root permissions.
A series, like this, but without spaces: x xxx xxx xxx. Ten characters in all. Removing the extreme left, as you mention, leaves nine. In my example above, each group of three begins with "r" leaving the following two unoccupied. The "r" is for read?

I tried chmod 777 on my program. The result: -rwxrwxrwx. I still have to use sudo. However, I have not gotten the password prompt again...
 

·
Moderator , Security Team
Joined
·
768 Posts
A text document in the same folder looked like this: -rw-r--r-- root root filename
OK, that means ...

- file is a file not a directory (other wise the first dash would be a d)

rw- means the User called Root has read, write permissions, but no execute permission
r-- means Group called Root has read permission, but no write or execute permissions
r-- means All other Users have read permission, but no write or execute permissions

Permissions are always in the order RWX (Read, Write, Execute)

If you think of RWX having a value of either 1 (on) or 0 (off), then ....

If you want a User or Group to have RWX then that's 111 (binary) which is 7 (decimel)
If you want a User or Group to have RW then that's 110 (binary) which is 6 (decimel)
If you want a User or Group to have only R then that's 100 (binary) which is 4 (decimel)

Permissions are also always applied in the order User, Group, All

So if you wanted to apply the permissions for the example in the quote box at the begining of this post, you would use ...

chmod 644 filename


Once you've got used to it, it's a very logical and simple system to use and to remember
 
1 - 8 of 8 Posts
Top