Ubuntu :: Write A Script To Cd Into A Directory

Apr 27, 2010

I have come across this question many times and recently had this discussion again: "I wrote a script to cd into a directory for me. How come it doesn't work when I run it?" I have seen some information out there on google but there doesn't seem to be one centralized answer, so I will try to offer one here. For those of us that have taken an operating systems course, you should understand why already (or I am assuming you know, as processes are such a fundamental part of an operating system). For everyone else, here is my simple/unofficial explanation, how to accomplish what you are after. This assumes you are running a bash shell (run the command "echo $SHELL" if you aren't sure). I can't be certain that all of the solutions below will work in all shells.

The shell, terminal, console, whatever you want to call it is a running process in the operating system. It has what is known as an "environment". You can see all of the variables in this environment by running the "set" command without any arguments. When you invoke a script, you are actually spawning a child process, that has a totally different environment. Any modifications made to the environment for the child process cannot be made to the parent environment. For example:

[Code]...

View 2 Replies


ADVERTISEMENT

Server :: Can't Write Files To A Sub-directory Of The Chroot Directory

Jul 20, 2011

I'm using OpenSSH 5.5p1 on Fedora 15. I'm trying to get a chrootDirectory to work. Specifically trying to figure out why I can't write files to a sub-directory of the chroot directory. I created a user test_user and created a group called sftp. I added test_user to the sftp group. I edited /etc/ssh/sshd_config as follows:

Code:

Subsystem sftp internal-sftp
Match group sftp
ChrootDirectory /home/sftp_users/%u
X11Forwarding no

[code]....

View 1 Replies View Related

Ubuntu :: Get Write Permission To A Directory?

Feb 21, 2010

I tried to read the File Permissions page on the wiki and my eyes glazed over after about three sentences. I've got a folder called /var/www/pics that I just want to be able to save image files to. My only other choice as I understand it is to save them to my home folder, then use a "sudo mv" command to copy files to that directory. How do I give my account permissions to save a file in that directory?

View 2 Replies View Related

Ubuntu :: Permission To Write INSIDE A Directory?

Mar 9, 2010

How do I use "chmod" command so that it allows me to write a file inside a certain directory ? This directory has permissions in the formdrwxr-xr-xOnce I try to write a file there, it says "Permission denied" ! Don't advise to use "sudo", since the file is created by some executable program compiled from a source code. If I was creating the file myself, I wouldn't have gone to this forum.

View 4 Replies View Related

Ubuntu Installation :: No Write Permissions On The Install Directory?

Sep 4, 2010

I'm pretty new to Linux but I know my way around. I've gotten Google Earth downloaded and am trying to install it. Everything is fine until I try to install it into /usr/local (or somewhere in there). The Google Earth Setup keeps telling me that I do not have write permissions on this directory. Question: How do I change the write permissions for this folder? Or should I install the program somewhere else? The last program I installed (xMind) installed into /usr/local.I am the only user (administrator

View 2 Replies View Related

Ubuntu :: Unable To Write Access To Home Directory

Jun 27, 2011

kernal 2.6.38-8 After updating Kubuntu-the log in screen will not progess to the desktop. It freezes and then shows the message "no write access to the home directory.." Goggling the problem - references to an .ICEauthority in my home directory are mentioned as linked to this problem. However "ls -la /home/charles" reveals that there is no .ICEauthority file present.

View 6 Replies View Related

General :: Best Way To Allow A User To Write To The /var/www Directory?

Mar 3, 2010

On my laptop for testing, I simply chown each subdir of /var/www to my myuser:www-data. But, now that I am setting up a public facing server, I'm wondering if this is the proper way to do so? If not, what is the best way to allow a non-root account to write to /var/www.

View 4 Replies View Related

General :: Cannot Write On Someone's Else /home Directory?

Sep 26, 2010

This might see a dump question but I will make it anyway .Here is the scenario:I have two users on my Linux Mint installation:

User A
User B

I want User A to be able to write on User B home directory, say /home/B.For this I have changed users's B home directory to look like this:ls -ld drwxrwxr-x 36 B music 4096 2010-09-26 10:31 /home/BI have created a "music" group and assigned to /home/B, so all users that are member of "music" are going to be able to write on User B home directory, right?The answer is No! Not here in my box Can you tell me why?Why users under group music can't write on /home/B if B directory is owned by group music and group music has write permissions?

View 5 Replies View Related

Programming :: Write A Script That Will Go Through The Files In A Directory?

Nov 19, 2008

How can I write a script that will go through the files in a directory and print on the screen the name of the files stating if it is a file or directory. The directory is already provided by the user.

View 12 Replies View Related

Debian :: Grant Apache 2 Write Privileges To A Directory

Feb 15, 2011

i want /mydata to be read/write by the web server. What group and user showld i use?

View 2 Replies View Related

General :: Chmod To Allow Read And Write Permissions For Directory?

Mar 31, 2010

I have created directories in root. I am looking for the chmod command to allow all users read and write permissions to a specific directory. I have done chmod 775 for a file but I need this for a directory. This includes permissions on all files and sub directories.

View 3 Replies View Related

Programming :: Write A Script That Will Calculate A Directory Size?

Jan 20, 2009

I'm trying to write a script that will calculate a directory size and if the size is greater than 4GB, it will send out an email. But I am getting the "integer operation expected" error when it tries to calculate the current disk size. Here's my script.

Code:

TO="user@email.com"
SUBJ="Ready for DVD burning on `hostname`"
MAIL="/bin/mail"

[code]....

View 1 Replies View Related

Programming :: How To Write Script That Would Use Join Across All Files In Directory?

Aug 19, 2010

I have a bunch of files that contain a date, then data. When I use join, I get exactly the output I need. But manually joining the first with the second, then that output with the third and so on would take days. I have thousands of files. Can any of you folks help me write a script that would do this?To put it another way, for clarity's sake, here is what I am currently doing

If I were to repeat that 3000 times the final output would be what I need. I know a simple script would do this for me, but I can't figure out how to write it.

View 12 Replies View Related

Ubuntu Installation :: Dh_auto_clean: Failed To Write To Debian/debhelper.log: No Such File Or Directory

Nov 3, 2010

fakeroot debian/rules clean dh clean dh_testdir i met error after "debuild -S", did anybody meet the same issue?

[Code]...

View 1 Replies View Related

Ubuntu :: Write A Bash Script Which Will Find Files Then Move Them To A Specific Directory?

Sep 1, 2011

I'm trying to write a bash script which will find files then move them to a specific directory.

So far I have:

Code:
#!/bin/bash
#script to find and move files
src_dir="/path/to/source/directory"
des_dir_mov="/path/to/destination/directory/for/movies"
des_dir_img="/path/to/destination/directory/for/images"
find $src_dir -iname '*.avi' -type f -exec mv '{}' $des_dir_mov ';'

I'd like to have all the possible movie file types then the image file types checked in a loop.

Every time I try to include an array in this script it breaks

View 3 Replies View Related

Programming :: Write A Bash Script That Continue Monitor The Tmp Directory?

Dec 25, 2010

In my tmp directory some logs are creating continue (with name logs.txt1, logs.txt2 up to 245). Some times these logs are creating continue within 1 or 3 second gap, now I want to write a bash script that continue monitor the tmp directory and if any time logs create simultaneously within 1 or 3 section gap it will alert me..( generally logs are create with the gap of 5 or 10 minutes duration or some time after one hours )

View 1 Replies View Related

General :: Giving User Write Access To Directory And Subdirectories

Aug 10, 2010

I need to give a user write access to /var/www and its subdirectories. The current directory permissions are as follows:rwx r-x r-x root root

I added the user to the root group but that didn't seem to help.I read I could chmod -R to change the access to write for the www directory and subdirectories but I don't want to change things and mess up the website. How can I give the user access to write to the www directory and subdirectories without messing anything up? Would changing the www directory group owner to his group cause an issue anywhere?

View 3 Replies View Related

General :: Write A Bash Script That Gets The List Of Files In A Directory?

Apr 5, 2010

I'm trying to write a bash script that gets the list of files in a directory and puts them into a variable, then checks each entry and outputs them as follows:

item1 is a FILE
item2 is a DIR
item3 is a DIR
etc etc.

I am able to get the list of files into a variable, but unsure how to get the output I want.

View 3 Replies View Related

General :: Root User Using Freshclam Command Cannot Write To Directory?

Jun 27, 2010

When I log on a root and attempt to issue the command Freshclam to upgrade the virus definitions it attempts or create a new file with a definition name. I get a message stating that the directory isnt writable. The user and group access rights are as follows:

USER = read, write, execute
Group = read, write, execute
All= read, execute.

The only way I can get around this is by applying a 777 which would be read, write and execute for all. Now, I have a group define with several user ids in it including Root.How do I connect the group with the directory/file so I dont have to apply a 777 access right to group users could issue the Freshclam command.

View 1 Replies View Related

Software :: Unable To Write Privileges On Wordpress Theme Directory?

May 22, 2011

I can't make write changes to .php files in my Wordpress editor, although I have already chmod -R 777 the directory. here is what ls -al says:

Code:

[root@localhost ~]# ls -al /usr/share/wordpress/wp-content/themes/purple-swirl/
total 12
drwxrwxrwx. 3 root root 4096 May 21 17:10 .
drwxrwxrwx. 4 root root 4096 May 21 17:10 ..

[code]....

View 6 Replies View Related

Programming :: Write A Script That Will Detect All The Unwanted Files In A Particular Directory

Apr 1, 2011

I want to write a script that will detect all the unwanted files in a particular directory and delete them in one fly..

View 11 Replies View Related

General :: Write A Shell Script Which Will Read The Directory Path As Input From User?

Nov 28, 2010

I am new to writing shell scripts. So, please bare with me. I am currently trying to write a shell script which will read the directory path as input from user and will traverse the Dir tree to find all available audio and video files. I have tried to write as much as I could but I don't know where I am making mistake as I get some files to be audio file which are actully tar balls. On the second note there are some files which video but script shows them to be audio. And, some video files are completely skipped. I am giving the shell script below so that you can see. I am using two external files as source which I am attaching.

Code:

#!/bin/bash
#Let's load the extensions that we want to search for
vdExt=$(cat vdExtList)
adExt=$(cat adExtList)

[code]....

View 5 Replies View Related

General :: Write A Script To Report Useful Information On Disk Utilization For Each User's Home Directory

Feb 27, 2010

I need to write a script to report useful information on disk utilization for each user's home directory.For each directory I need to show: 1. the long listing of that directory entry (but not the files in the directory), so that I can see the rights and owners of the directory.2. The amount of disk used by that directory, in human-readable format, including subdirectories. I need to have two lines for each user one after the other. For example:

/home/user1 directory info
/home/user1 disk usage
/home/user2 directory info
/home/user2 disk usage

The script will assume that all users, except user root, have their home directories in the /home directory (no need to do anything with the /etc/passwd file). And if the administrator adds or removes users, the script should still work correctly (so the script shows the information for all current users).

Here's what I do know. The command "ls -ld /home/user's_name" will give me the info I need for #1. And the command "du -hs" will give me the info I need for #2. What I don't know is how to grab each individual directory in order to apply the above commands to each of them in order. ???

View 14 Replies View Related

CentOS 5 :: Yum Stopped Working - Errors Returned While Uploading " Failed To Open Directory With Write Permission"?

Jul 26, 2009

Its been a while (maybe too long) since I last used yum to check for updates / install anything on my server, but when I tried the other day I got the following response:

# yum list updates
Loading "installonlyn" plugin
Setting up repositories
Error: Cannot find a valid baseurl for repo: updates[code]......

Trying other mirror.Error: Cannot open/read repomd.xml file for repository: updates

A few weeks ago there were some network changes, but nothing else should have changed OS side.I have checked /etc/resolv.conf and that looks ok - ping and wget have no problem resolving hostnames.I tried setting enabled=0 in yhe .repos files - this allowed me to do a 'yum list', but 'yum list updates' returned an empty list - I am definitely not 100% up to date!

P.S. Attachment not there at the moment - getting the following error when I try to upload the zip file...Errors Returned While Uploading

Failed to open directory with write permission: /var/wwwthtml/oldwebcopy.centos.org/uploads/newbb

View 7 Replies View Related

Hardware :: Mtrr: Type Mismatch For C0000000,10000000 Old: Write-back New: Write-combining?

Jan 31, 2011

solve the following problem...mtrr: type mismatch for c0000000,10000000 old: write-back new: write-combiningThis i am getting many lines in DMESG.

View 10 Replies View Related

Fedora :: Erroneous Write During File Extend. Write -1 Instead Of 4096

Nov 17, 2009

Ive installed Gaussian '03 on fedora Core 10, but I'm unable to run it. It aborts and i get the following error

Code:

Erroneous write during file extend. write -1 instead of 4096
Probably out of disk space.
Write error in NtrExt1

View 3 Replies View Related

General :: Write A Shell Script Which Will Simultaneously Collect OS User Information And Write In An Individual Text Files?

Feb 17, 2010

I want to write a shell script which will simultaneously collect OS user information and write in an individual text files.Can anyone tell me the syntax of the script.N.B. The user name will be mentioned in an array within the shell script.

View 8 Replies View Related

Ubuntu :: Can't Write To USB On 11.04 \ Can't Write To USB On Natty?

May 3, 2011

I can't write to USB on Natty. I can read the files and copy them to my netbook fine, but I can't change anything, I can't write or delete files

View 1 Replies View Related

Ubuntu Installation :: Disk Space - Failes On A "E: Write Error - Write (28 No Space Left On Device)"

Jan 4, 2011

df -h [URL] I did the following command to find everything is in /usr or /var, then tracked it down to /usr/lib and /usr/share as the main offenders, but out of all the directories none are more than 1mb or so.

du -sh /* | sort -gr | head -n 5

I tried to uninstall firefox, which is what got me in this mess in the first place, the log claims it will remove ~240 mb but failes on a "E: Write error - write (28 No space left on device)" [URL] If I could juggle something onto an external hard drive so I can uninstall firefox I would be out of the wood. Failing that I believe a new install is in order.

View 1 Replies View Related

Ubuntu :: Hidden Directory 'RECYCLER' Creates .exe File In Directory Called 0x2D9FA278

May 30, 2011

I've done a low level format on them so they're completely empty. When I use them with my windows machines, they're absolutely fine. When I plug them into my Ubuntu machine, there is a hidden directory created called 'RECYCLER' which I'm assuming is for deleted files?However, it also creates a .exe file in this directory called 0x2D9FA278 which has an Icon with an H in it and a comment of 'Facebook Photo' This has the effect of making all the directories on the stick into shortcuts! I googled the file name and it seems to be some sort of Trojan, but I don't understand how it's go into my Ubuntu machine, I've scanned with ClamAV and it finds nothing.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved