0

I was trying to set up Tomcat to use with Java, and somehow moved /Users/me to /usr/local/me. When I try to open any icons on desktop, they do not open, but everything that was already open still functions / saves fine (at least it seems).

My question: How can i move (user) tori from usr/local/tori back to Users/tori where it belongs, without breaking anything? (I've had enough "fun" for the week).

Everything that follows is just context to how I got there and may well be irrelevant for answering, I am including it in case it is relevant. Thank you so much!!


Current situation:

When I start a new terminal session, I get:

No home directory: /Users/tori mkdir: //.bash_sessions: Permission denied touch: //.bash_sessions/817C7D82-8749-4B96-9AC6-CAA07F9CE1B0.historynew: No such file or directory  

$USER / who / w / whoami output: tori, the right user at least.

$ finger tori Outputs: .. Directory: /Users/tori (note: there is not a Users/tori when I cd into Users).


Commands I ran leading up to current situation:

$ sudo ln -s /Applications/tomcat-apache-9.0.30 --- I did enter password. I realize I did not put the desired name of the link after this, doubt this caused the error.

$ sudo chown -R tori /Applications/tomcat-apache-9.0.30 --- I was NOT prompted to enter password

$ sudo chmod +x /Applications/tomcat-apache-9.0.30/bin/*.sh I was NOT prompted to enter password

$ sudo chmod +x ./bin/*.sh + I did enter password. Is to make all .sh files executable. I was trying to execute bin/catalina.sh start (and variants thereof) to start Tomcat server (I didn't get it to start yet).

$ bin/catalina.sh start    Output: bin/catalina.sh: /bin/sh^M: bad interpreter: No such file or directory

$ sed -i -e 's/\r$//' catalina.sh Attempt to fix ^M errors (I tried to brew install dos2unix and got errors).

$ sudo chown -R $USER ~/.bash_sessions; chmod 700 ~/.bash_sessions

Output:

chown: //.bash_sessions: No such file or directory
chmod: //.bash_sessions: No such file or directory

EDIT

output of ls -la /usr/local/tori ,as suggested:

total 960
drwxr-xr-x+  66 tori  staff    2244 Dec 24 20:39 .  
drwxr-xr-x   16 root  wheel     544 Dec 24 20:57 ..
-r--------    1 tori  staff       7 Nov 17  2017 .CFUserTextEncoding
-rw-r--r--@   1 tori  staff   18436 Dec 29 17:20 .DS_Store
drwx------@   3 tori  staff     102 May  5  2018 Applications  
drwx------+  44 tori  staff    1496 Dec 24 21:01 Desktop
5
  • There’s lots missing here. 1st, no command there will move your home directory. 2nd, you’re missing lots of leading slashes (“/“) in your commands (i.e. /usr/local/tori); this is critical. 3rd, you mention a script named catalina.sh; we don’t know what’s in that script. Finally, you didn’t say what version of macOS you’re using. If it is Catalina, you should be prevented from doing this – Allan Dec 30 '19 at 0:16
  • Also, sudo caches you’re password for a time period (1 min. I think) so entering subsequent sudo commands after previously entering a password won’t require it again. This is normal. – Allan Dec 30 '19 at 0:18
  • Also, there is no tomcat-apache-9.0.30 but an apache-tomcat-9.0.30 (available at tomcat.apache.org/download-90.cgi)! – klanomath Dec 30 '19 at 0:40
  • What a mess! The user folder was apparently moved (or copied) to /usr/local/ on Dec 24 at 20.57. Almost impossible to get the root cause... – klanomath Dec 30 '19 at 1:08
  • Is there still a problem to be solved? Your last line in the question indicates that there isn‘t, is this correct? If the problem persists, please cleanup your question (see comments above, most of the stuff in the question doesn‘t seem to relate to the problem you have). – nohillside Dec 30 '19 at 6:48
1

First: nothing in the commands you listed should have moved your home directory (unless there's something even weirder than carriage returns in catalina.sh?), so I'd run some additional checks to makes sure that's what actually happened before trying to fix it based on that assumption. First, run ls -lae /usr/local/tori and verify its output. You should see your regular home directory contents (including Desktop, Documents, etc, and probably a bunch of dotfiles). Make sure they're all owned by your account. Make sure the "." entry (the directory itself) is also owned by you. (The parent directory, "..", might be owned by root or something; that's ok.) Some of the standard subfolders should have an ACL like "0: group:everyone deny delete" on them. (So should the directory itself, but if it had you wouldn't have been able to do this, so it must not be there.)

If things aren't all there, aren't owned by you, or anything else looks weird, stop and investigate further before proceeding.

If that looks ok, and /Users/tori doesn't exist, then you should be able to fix it with:

sudo mv /usr/local/tori /Users/tori

Note: in your question, you used a number of absolute-looking paths without the leading "/" (e.g. usr/local/tori instead of /usr/local/tori). The difference matters; if you use a path that doesn't start with "/" (or "~"), it'll be resolved relative to your current location, which might not be what you expect.

Also, since we don't know what caused this, I'd take a really close look at the catalina.sh script, to make sure this doesn't happen again. And make sure you have a good backup of your system, in case things do go sideways again.

0

I would recommend restoring a backup of your entire disk from a time before the 'strangeness' happened. Manual methods will only work if you have identified everything that needs to be moved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .