Ubuntu :: Bash: User Prompts And Directory Changing?
Mar 2, 2011
Basically I'm trying to create a bash script that'll ask for a folder name and then change into that folder.
Code:
Not real code but bare with me!
echo "Enter the desired folder and press [ENTER]
read $folder
cd $folder
pwd
/home/<user name>/<whatever the user entered>
Is this possible with bash or am I chasing a pipe dream?
View 1 Replies
ADVERTISEMENT
Mar 28, 2010
I'm still pretty new to linux, and burning through a unix/linux course offered at the local JC. I'm working on an assignment for shell scripting and I need to make a script that displays a bunch of junk (pwd, date, yadda yadda) and then prompts the user to enter a directory so they can view the contents. If it's valid, then it displays the contents. If it isn't then it throws an error message and the script stops. This is done using if, then and else. The problem is, my script always shoots straight to the else, even if the subdir entered IS a valid subdirectory.Here's what I have:
Code:
clear
pwd
[code]....
View 3 Replies
View Related
Feb 2, 2011
created a user but i forgot to change the home directory permission.so after user created when i go to the user and group mangement i cant see that permission filed related to the home permission directory.my purpose is to stop accessing other user to my home directory,how it can be possible??
View 4 Replies
View Related
Jul 4, 2009
I would like to change the start directory, the directory at which ftp/shell points to when the user logs in.
View 1 Replies
View Related
Feb 15, 2010
I was setting up a Samba server and I ran into some problems with SELinux related to the context of the home directories. I made a user account, say "UserAccount", with a default home directory "home/UserAccount". Afterwards I realized that I needed to move the home directory of this particular user to another location, say "/home2/UserAccount". So I created the new directory, changed the permissions, and used Gnome's system-config-user to change the user's home directory.
I then set-up the Samba server, activated samba_run_unconfined and samba_enable_home_dirs in SELinux, and made an account for UserAccount. When testing the Samba account for UserAccount SELinux denied read access. I checked the context and the new home directory did not appeared to have been updated. I had to manually run:
restorecon -R -v /home2/UserAccount
to set the context on the new home directory. I'm not very familiar with SELinux, so my question is this: is this normal security policy or is a bug in the system-config-user tool? If it's normal policy can someone explain why? I'm always ready to learn Distro: Fedora 12 (kernel: 2.6.31.5-127.fc12.i686) System: Dual Intel Xeon @ 3.2 GHz, 1 GB RAM
View 4 Replies
View Related
Aug 7, 2010
I got a good one!I colorized my prompt as follow; Green for normal user, Red for root:
Root .bashrc:
PS1=e[0;31m[ ][u@h:w][!]\$ e[m"
User .bashrc:
PS1="e[0;37m[ ][u@h:w][!]\$ e[m"
Which gives:
[Code]...
View 7 Replies
View Related
Dec 10, 2010
I have been searching for 90 minutes for something that I "think" should be fairly easy. I'm pretty new to Bash Scripting so I could be completely wrong. Then again it may be a weird request to even need something like this. But here it is.I have a script written to convert data from one of our software version to another. The only thing I need to add to it is a "check to make sure the user running the script is in the /tmp directory".
View 7 Replies
View Related
May 30, 2010
Kubuntu live CD prompts me for user name password, what is it? I've tried all obvious blank, kubuntu etc, none worked.
View 2 Replies
View Related
Jul 14, 2010
How to change the password of Directory Manager in RED HAT Directory Services through a ldapclient through command line or graphical.
View 1 Replies
View Related
Apr 15, 2011
Is it possible to copy files from directory of one user to directory of another user in linux?
View 7 Replies
View Related
Aug 19, 2011
I've run into a problem with my bash program.
Code:a mkdir -p /home/chris/Downloads/ARCHIVE/`date -I` find /home/chris/Downloads* -mtime +14 -exec "cp {} /home/chris/Downloads/ARCHIVE/`date -I` ;
It's meant to move old files from my Downloads folder into an archive file (later tar them). The directory exists, I've used $PWD and nautilus and ls to make sure it's there, yet for every file it gives
Code: find: `cp /home/chris/Download/foo.bar /home/chris/Downloads/ARCHIVE/2011-08-19': No such file or directory I tried to test it on a different destination, specifically my home folder. IT still gave me the error.IS it a bad syntax within find or something else? I'm running a 32-bit system with 11.04
View 4 Replies
View Related
Apr 9, 2011
I'm trying to jail a sftp user. All I want is for my daughter-in-law to be able to download pictures of my grandson on his step-uncle's motorcycle. But I don't want her browsing around. She's not a techie, but she's smart enough to catch on how WinSCP is looking at my files. I've set up the jail using jk_init, adding ssh, sftp, bash, netutils, basicshell, jk_lsh.
The physical root of the jail is owned by root, as are all the binaries loaded by the jk_init. The user's home directory is owned recursively by the user and is writable only by the owner. The passwd and group files are in the jailed /etc and populated by the user's lines. Shell is bash, and bash is there too. The error message must be coming from some other problem that's not notifying, but what?
View 4 Replies
View Related
Jun 16, 2011
Do you think there is a way of accessing different user data from another account which I have set up.
Ie. user 1 = account has messed up
user 2 = account works fine
access user account 1 home directory from user 2 work space?
View 9 Replies
View Related
Jun 21, 2011
I get the following error whenever I launch bash:
Code:
mkdir: cannot create directory `/dev/cgroup/cpu/user/5900': No such file or directory
bash: /dev/cgroup/cpu/user/5900/tasks: No such file or directory
bash: /dev/cgroup/cpu/user/5900/notify_on_release: No such file or directory
It seems like it's probably from this part of .bashrc:
[Code]...
What does this code do, why, and what's causing it to go wrong?
View 7 Replies
View Related
Jul 28, 2011
i'm new to linux and just installed Ubuntu and decided to play around with it. i just executed
Code: useradd test which supposedly creates a folder in the home directory '/home/test' but when i look in there i can't see it i also did a
Code: grep test /etc/passwd which returns: 'test:x:1001:1001::/home/test:/bin/sh' which i believe means it is meant to exist.
Addendum: I have also now noticed that when i log in and log back in i have the option to login as 'test' but it prompts me for a password which i did not set :s
View 5 Replies
View Related
Apr 9, 2011
How can I go about making an echo with specific text in colour in bash?. this is the result I want: Code: I like Red!
View 4 Replies
View Related
Mar 24, 2010
I was attempting to change the bash shell color prompt on my RHEL / CentOS 5 server. When I login as my user account on my server I can see my 'PS1':
Code:
[carlos@srv1 ~]$ echo $PS1
[u@h W]$
I want to change my PS1 to:
PS1='[e[1;32m][u@h W]$[e[0m] '
When I look in ~/.bashrc, I don't see my 'PS1' line so I am confused and wondering how I do this on RHEL / CentOS systems.
View 2 Replies
View Related
Mar 8, 2010
I'm developing an application in which one user must run java software that I'm compiling as another user. I wanted to give user A permission to see the bin direcory of my workspace, which is in the home directory of user B. I was wondering how can this be done? I gave the bin direcotry full read/execute premissions, but since it's in my home directory user A can't navigate to it.
I know there are a few ways I could get around the problem but they arn't very elegant. I was wondering if there is a simple method for giving a user access to a specific directory without giving access to all the parent directories. I tried symbolic link but user A still can't access it, and a hard link to a directory isn't allowed in Linux. I don't feel like making a hard link to every single file in the bin directory, and I'm not sure that would work anyways, since every recompile overwrites them.
View 7 Replies
View Related
May 12, 2011
i have rhel 5.2 and i want to create user using useradd command without creating user home directory and not throwing any warning/error about not creating any home directory.i have tried useradd -u "$NEW_UID" -g <gid> -d "/home/$1" -M "$1"where $1 is user name and $NEW_UID is i am calculating.it throws error as useradd: cannot create directory /home/$1which i dont want to come , how to prevent this?
View 1 Replies
View Related
Oct 16, 2010
Can look at attached screenshot and tel me why I can't cd to.....
View 5 Replies
View Related
Apr 15, 2009
I've been looking for this feature for months and couldn't find a solution for this. Does anyone know how to create users and limit the user to a specified directory?
View 6 Replies
View Related
May 27, 2010
People usually suggest workarounds to do this, as it's not possible with usermod while the user is logged in. Did I overlook anything or is this method not preferable over creating a new account, setting the user permissions, then moving the files and messing with the file permissions? Using the right tool for the job would seem to be less error-prone to me. 1. Activate the root account by setting a password.
Code:
sudo passwd
2. Log out and log into the root account.
3. Change the username and home directory from user1 to user2. This will also move the files to the new home directory and rename the group to user2.
Code:
usermod -l user2 -d /home/user2 -m user1
[Code]...
View 3 Replies
View Related
Apr 7, 2011
I have a dual-boot win7 and Ubuntu 10.10 and I want Ubuntu to use my windows user folder as home. I edited fstab to give me ownership and mount it to /mnt/Windows at startup but whenever I change the location of home in the Users and Groups it acts like it is changing it but it never does. I close the settings and when I re-open it, it is set back to /home/me.
View 5 Replies
View Related
Jun 21, 2010
I have a user that has been used for long time now that runs o C Shell... now there is a need to change it to Bash Shell? Can I cause a problem changing his shell from C to bash? I mean apps or variables?
View 2 Replies
View Related
Apr 22, 2010
I am writing a bash script that utilizes the output of another script (which I will refer to as script#2.) Script#2 is not owned by me, I cannot modify it. All of the output from script#2 is blue, which makes it difficult for me to read.
I would like to have the output of it changed to grey. Is there a way I can do that in my script? A command I can pipe the output to?
Edit: One other question related to this. I put a trap function in my script that works well. Script#2 essentially runs a tail -f. When I ctrl+c to stop it, it stops script#2 and never calls the trap in my script. Is there any way I can work around that?
View 3 Replies
View Related
May 2, 2010
Earlier this morning I made my girlfriend an account on my Ubuntu desktop, I entered all the information, (username, full name etc.) and it worked fine. When I went to GDM I noticed that it displays both her full name, and username, but I seem to have my first name only as both my full name and user name (it just says "luke" twice).
I hadn't really paid attention to this before, but now it looked really odd with my girlfriend's full name, but only my first name. So I went to change it. Where to do that? I tried System->Preferences->About Me and System->Administration->Users and Groups, but I can't see "Full name" anywhere. In the end I used chfn on the command line to do it, but surely Ubuntu 10.04 isn't missing graphical a way to change a users full name is it?
View 2 Replies
View Related
Jul 12, 2010
Is there a way to have a directory automatically change the permissions of a file that is written to it? I have a program which saves files to a directory, and gives those files read-only permissions to members in the group. This is a problem, because other users of my computer need to be able to edit these files. The directory itself has rw permissions for group members.
I guess what I am looking for is a way for the directory permissions to "override" the permissions the program is trying to save the files as. For example, if the directory has "rw" permissions for the group, then any file saved to it will automatically get the same permissions, regardless of what the program writing the file is trying to do.
View 3 Replies
View Related
Apr 17, 2010
I just got a 1.5 terrabyte Western Digital My Book 1110 external usb 2 drive. I used Gparted to reformat the drive to ext3. The problem I have is I can't change the file permissions for the drive because it says the drive is owned by root. I can't back up my files into the drive because it won't allow me to. I am using Jaunty Jackalope and got this drive to back up my files so I can feel comfortable in upgrading to Karmic Koala in case there are major problems with the upgrade.
I know someone out there in the community can tell me the commands to use in the terminal to let me gain ownership of this external drive from root so I can copy my files into it. the entire drive itself is seen as /dev/sdb One meg of the drive is unallocated and the part of the drive that I reformated is seen as /dev/sdb1 my personal files are owned by the name of dave
View 6 Replies
View Related
Sep 20, 2010
I run both Mac OS X and Lucid. I backed up my OS X partition in preparation for a restore. I also moved over important work documents to Lucid. Restored OS X using timemachine. Updated OS X with patches and moved over some files from external hard drive. After moving the files over, timemachine backed up system. I went into Time machine to transfer work documents over but the previous back up was deleted for the new one. I had the documents on Lucid. I just needed to switch it over to OS X. Therefore, I tried to enable read/write from Lucid to Mac OS X partition.
1. sudo usermod -u osx-uid ubuntu-username # change Ubuntu UID to 501
2. sudo umount /osx # UNMOUNT OSX PARTITION FIRST!!!
3. sudo find / -uid old-ubuntu-uid -print0 | xargs -0 chown osx-uid # change file permissions
OS X was unmounted prior to entering commands and performed the steps above under a different user. During step 3 I received an error stating you do not have sufficient privileges and the process stopped. I logged out of my temporary account and tried logging back into my main account. Main account was not present on the login screen. So I followed these steps to change my UID and GID from 501 back to 1000. Login appeared. I tried to login but there was an error about ICEauthority and Nautilus. System doesn't load up and only shows wallpaper. I haven't deleted anything and I expect that I just need to point my UID back to wherever my home folder is.
View 2 Replies
View Related
Jan 30, 2011
I'm wanting to have a personalized photo on each user on the login screen, but am having difficulties figuring it out. I've done some searching here on the forums but haven't come up with anything yet. I'm using Pinguy OS 10.10.
View 4 Replies
View Related