Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Moving a bash script to /usr/bin
New Posts  All Forums:Forum Nav:

Moving a bash script to /usr/bin

post #1 of 9
Thread Starter 
I'm trying to move a few of my bash scripts to /usr/bin so I can run them with autocomplete but I'm running into issues.

Say I have a file that is gpsshredder.sh.

I run sudo chmod a+x ~/Desktop/gpsshredder.sh and I can now run it.

Then when I move it to /usr/bin, it makes it have root permissions again. I shouldn't have to run the script with sudo. It's my gps data shredder script that removes my GPS info from pictures I take with my phone.

The end goal is I want it to be gpsshredder (with no .sh) with the path to the file I want to remove gps data from.
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
post #2 of 9
Thread Starter 
I think I got it. I just changed the ownership to me.

Follow up question though. In the permissions page for /usr/bin, it has my username listed for the group. I don't think that's right. Shouldn't the group be root as well?
Edited by TFB - 1/24/11 at 5:16am
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
post #3 of 9
When you move files its recreates the file and then erases the original. When you sudo that, it makes root create the new file thus changing the owner of the new file to root.

I ran into this issue a few times.

In terms of your second question, I don't know. I'm still a noob to linux but I'm learning as I explore. Figured I'd explain that.
Nightshade
(20 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4930k Asus Rampage IV Extreme EVGA - Titan-X Superclocked EVGA - Titan-X 
RAMHard DriveHard DriveHard Drive
64 GB Corsair Vengance DDR3 OCZ Agility 3 Intel 540 240GB 7200 RPM Platter Drive 
Hard DriveCoolingOSMonitor
1TB Mushkin SSD Watercooled Windows 10 Pro x64 ASUS ROG Swift 
KeyboardPowerCaseMouse
Razer Black Widow Chroma Corsair RM1000 Corsair 900D Razer Deathadder Chroma 
Mouse PadAudioOther
Steelseries Soundblaster Z Speakers: Logitech z5500 
  hide details  
Reply
Nightshade
(20 items)
 
  
CPUMotherboardGraphicsGraphics
i7-4930k Asus Rampage IV Extreme EVGA - Titan-X Superclocked EVGA - Titan-X 
RAMHard DriveHard DriveHard Drive
64 GB Corsair Vengance DDR3 OCZ Agility 3 Intel 540 240GB 7200 RPM Platter Drive 
Hard DriveCoolingOSMonitor
1TB Mushkin SSD Watercooled Windows 10 Pro x64 ASUS ROG Swift 
KeyboardPowerCaseMouse
Razer Black Widow Chroma Corsair RM1000 Corsair 900D Razer Deathadder Chroma 
Mouse PadAudioOther
Steelseries Soundblaster Z Speakers: Logitech z5500 
  hide details  
Reply
post #4 of 9
Thread Starter 
yeah, it's the weirdest thing, that second part at least. I have no idea why the permission group got changed. I changed it back to root though.
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
post #5 of 9
Yeah there is no "move", think of it as real life teleportation; Creation and Deletion. When you create the second file it's created with the permissions of the creator, sudo being root makes the file a root owned file.

As far as group? You can either do "chown :users " Or just do "chown " It doesn't matter if your name is in the group, as I think every time you create a user he/she is their own group anyways.
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
post #6 of 9
Thread Starter 
I changed it back to root. I'm just trying to figure out why it changed.
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
post #7 of 9
Quote:
Originally Posted by TFB;12124186 
I changed it back to root. I'm just trying to figure out why it changed.

The group doesn't have to be root, especially with custom scripts. I have mine under mrshroom/mrshroom. As long as it doesn't hinder the functionality of the script. Though I think root is supposed to own all of /usr/bin and it's just permissions that are changed. I might be wrong. If you want to know permissions of the files you know you can always do "ls -l" and then match your script to the rest of the files. =)
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
post #8 of 9
Thread Starter 
I think you're right. The thing I don't understand is how it was changed. That's the thing that is bothering me.
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
Q9550 Gigabyte EP45-UD3P EVGA GTX 465 4x2GB G.Skill 1066 
Hard DriveOSMonitorPower
750GB WD Caviar Black Windows 7 ASUS VW224U Dual Screens Corsair 750w HX 
Case
CM Storm Sniper Black 
  hide details  
Reply
post #9 of 9
mv essentially stamps permissions on the file based on the umask set by the system for that user.
Deimos
(13 items)
 
Pluto
(18 items)
 
 
CPUMotherboardGraphicsRAM
AMD 1090T Biostar TA890FXE Nvidia GTX 470 Corsair Vengence 
Hard DriveHard DriveHard DriveHard Drive
Samsung 830 MZ-7PC128D/AM Western Digital Black Western Digital Green Western Digital Blue 
CoolingOSOSMonitor
Dtek v2 Water Windows 7 Pro Fedora 16 LG4250 42" LCD TV 
KeyboardPowerCaseMouse
Microsoft Ergo Silverstone ST-1000P Cooler Master Cosmos 1000 Logitech G500 
Mouse PadAudio
X-Trac Ripper Asus D1 
  hide details  
Reply
Deimos
(13 items)
 
Pluto
(18 items)
 
 
CPUMotherboardGraphicsRAM
AMD 1090T Biostar TA890FXE Nvidia GTX 470 Corsair Vengence 
Hard DriveHard DriveHard DriveHard Drive
Samsung 830 MZ-7PC128D/AM Western Digital Black Western Digital Green Western Digital Blue 
CoolingOSOSMonitor
Dtek v2 Water Windows 7 Pro Fedora 16 LG4250 42" LCD TV 
KeyboardPowerCaseMouse
Microsoft Ergo Silverstone ST-1000P Cooler Master Cosmos 1000 Logitech G500 
Mouse PadAudio
X-Trac Ripper Asus D1 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Moving a bash script to /usr/bin